Skip to content

Commit

Permalink
make totalOperatorsForQuorum work in the empty case
Browse files Browse the repository at this point in the history
  • Loading branch information
gpsanant committed Oct 2, 2023
1 parent 11a8da3 commit dd27549
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/contracts/middleware/IndexRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ contract IndexRegistry is IIndexRegistry {
}

function totalOperatorsForQuorum(uint8 quorumNumber) external view returns (uint32){
return _totalOperatorsHistory[quorumNumber][_totalOperatorsHistory[quorumNumber].length - 1].index;
uint256 totalOperatorsHistoryLength = _totalOperatorsHistory[quorumNumber].length;
if (totalOperatorsHistoryLength == 0) {
return 0;
}
return _totalOperatorsHistory[quorumNumber][totalOperatorsHistoryLength - 1].index;
}

/**
Expand Down

0 comments on commit dd27549

Please sign in to comment.