Skip to content

Commit

Permalink
Ensure Initialize Dynamic Results Array for Group Members (#337)
Browse files Browse the repository at this point in the history
  • Loading branch information
kingster-will authored Dec 10, 2024
1 parent 9d66823 commit 1404375
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contracts/registries/GroupIPAssetRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ abstract contract GroupIPAssetRegistry is IGroupIPAssetRegistry, ProtocolPausabl
) external view returns (address[] memory results) {
EnumerableSet.AddressSet storage allMemberIpIds = _getGroupIPAssetRegistryStorage().groups[groupId];
uint256 totalSize = allMemberIpIds.length();
if (startIndex >= totalSize) return results;
if (startIndex >= totalSize) return new address[](0);

uint256 resultsSize = (startIndex + size) > totalSize ? size - ((startIndex + size) - totalSize) : size;
results = new address[](resultsSize);
for (uint256 i = 0; i < resultsSize; i++) {
results[i] = allMemberIpIds.at(startIndex + i);
}
Expand Down

0 comments on commit 1404375

Please sign in to comment.