Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions Frameworks/Foundation/NSArray.mm
Original file line number Diff line number Diff line change
Expand Up @@ -818,14 +818,21 @@ - (NSUInteger)hash {
@Status Interoperable
*/
- (NSArray*)objectsAtIndexes:(NSIndexSet*)indexes {
unsigned idx = [indexes firstIndex];
id ret = [NSMutableArray array];
unsigned count = [self count];
NSUInteger idx = NSNotFound;
id ret = nil;
NSUInteger count = [self count];

if (indexes == nil)
[NSException raise:NSInvalidArgumentException format:@"No index set"];
else {
ret = [NSMutableArray array];
idx = [indexes firstIndex];
}

while (idx != NSNotFound) {
if (idx >= count) {
TraceCritical(TAG, L"objectsAtIndexes: index > count (%d > %d), throwing exception", idx, count);
[NSException raise:@"Array out of bounds" format:@""];
[NSException raise:NSRangeException format:@"Index out of bounds"];
return nil;
}
[ret addObject:[self objectAtIndex:idx]];
Expand Down