Created
October 21, 2016 02:48
-
-
Save jackyshan/4678965cf06335d0a139f0cc497ba37e to your computer and use it in GitHub Desktop.
runtime轻松实现数组越界防止崩溃
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (id)jkobjectAtIndex:(NSUInteger)index { | |
if (index >= self.count) { | |
YTLog(@"数组越界了------%@", [self class]); | |
return nil; | |
} | |
return [self jkobjectAtIndex:index]; | |
} | |
- (void)jkinsertObject:(id)anObject atIndex:(NSUInteger)index { | |
if (!anObject) { | |
YTLog(@"数组内插入了一个nil对象--------%@", [self class]); | |
return; | |
} | |
return [self jkinsertObject:anObject atIndex:index]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment