JJException
JJException copied to clipboard
想问一下为什么这里有个等号?照理说下标要比数量少1的。然后有第三方库奔溃在这,但是这库没开源,麻烦看一下
- (void) hookInsertObject:(id)anObject atIndex:(NSUInteger)index { if (anObject && index <= self.count) { [self hookInsertObject:anObject atIndex:index]; }else{ handleCrashException(JJExceptionGuardArrayContainer,[NSString stringWithFormat:@"NSMutableArray insertObject invalid index:%tu total:%tu insert object:%@",index,self.count,anObject]); } }
The index in the array at which to insert anObject. This value must not be greater than the count of elements in the array.
根据官方的解释,index不能大于集合的数量,可以等于的(我已验证), 是不是其他问题?