diff options
Diffstat (limited to 'Source/SPArrayAdditions.h')
-rw-r--r-- | Source/SPArrayAdditions.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/SPArrayAdditions.h b/Source/SPArrayAdditions.h index 565e0393..cf3673d5 100644 --- a/Source/SPArrayAdditions.h +++ b/Source/SPArrayAdditions.h @@ -86,4 +86,14 @@ static inline void NSMutableArrayReplaceObject(NSArray *self, CFIndex idx, id an - (NSArray *)subarrayWithIndexes:(NSIndexSet *)indexes; +/** + * Variant of objectAtIndex: that avoids the "index out of bounds" exception by + * just returning nil instead. + * + * @warning This method is NOT thread-safe. + * @param index An index + * @return The object located at index or nil. + */ +- (id)objectOrNilAtIndex:(NSUInteger)index; + @end |