Index: src/OFArray_adjacent.m ================================================================== --- src/OFArray_adjacent.m +++ src/OFArray_adjacent.m @@ -215,16 +215,24 @@ return [_array items]; } - (id)objectAtIndex: (size_t)index { - return *((id*)[_array itemAtIndex: index]); + @try { + return *((id*)[_array itemAtIndex: index]); + } @catch (OFOutOfRangeException *e) { + @throw [OFOutOfRangeException exceptionWithClass: [self class]]; + } } - (id)objectAtIndexedSubscript: (size_t)index { - return *((id*)[_array itemAtIndex: index]); + @try { + return *((id*)[_array itemAtIndex: index]); + } @catch (OFOutOfRangeException *e) { + @throw [OFOutOfRangeException exceptionWithClass: [self class]]; + } } - (void)getObjects: (id*)buffer inRange: (of_range_t)range { Index: src/OFDictionary_hashtable.m ================================================================== --- src/OFDictionary_hashtable.m +++ src/OFDictionary_hashtable.m @@ -305,11 +305,17 @@ [super dealloc]; } - (id)objectForKey: (id)key { - return [_mapTable valueForKey: key]; + @try { + return [_mapTable valueForKey: key]; + } @catch (OFInvalidArgumentException *e) { + @throw [OFInvalidArgumentException + exceptionWithClass: [self class] + selector: _cmd]; + } } - (size_t)count { return [_mapTable count]; Index: src/OFMutableArray_adjacent.m ================================================================== --- src/OFMutableArray_adjacent.m +++ src/OFMutableArray_adjacent.m @@ -65,12 +65,16 @@ { if (object == nil) @throw [OFInvalidArgumentException exceptionWithClass: [self class]]; - [_array insertItem: &object - atIndex: index]; + @try { + [_array insertItem: &object + atIndex: index]; + } @catch (OFOutOfRangeException *e) { + @throw [OFOutOfRangeException exceptionWithClass: [self class]]; + } [object retain]; _mutations++; } @@ -78,13 +82,17 @@ atIndex: (size_t)index { id *objects = [array objects]; size_t i, count = [array count]; - [_array insertItems: objects - atIndex: index - count: count]; + @try { + [_array insertItems: objects + atIndex: index + count: count]; + } @catch (OFOutOfRangeException *e) { + @throw [OFOutOfRangeException exceptionWithClass: [self class]]; + } for (i = 0; i < count; i++) [objects[i] retain]; _mutations++; Index: src/OFMutableDictionary_hashtable.m ================================================================== --- src/OFMutableDictionary_hashtable.m +++ src/OFMutableDictionary_hashtable.m @@ -36,17 +36,29 @@ } - (void)setObject: (id)object forKey: (id)key { - [_mapTable setValue: object - forKey: key]; + @try { + [_mapTable setValue: object + forKey: key]; + } @catch (OFInvalidArgumentException *e) { + @throw [OFInvalidArgumentException + exceptionWithClass: [self class] + selector: _cmd]; + } } - (void)removeObjectForKey: (id)key { - [_mapTable removeValueForKey: key]; + @try { + [_mapTable removeValueForKey: key]; + } @catch (OFInvalidArgumentException *e) { + @throw [OFInvalidArgumentException + exceptionWithClass: [self class] + selector: _cmd]; + } } #ifdef OF_HAVE_BLOCKS - (void)replaceObjectsUsingBlock: (of_dictionary_replace_block_t)block {