Index: src/OFDataArray.m ================================================================== --- src/OFDataArray.m +++ src/OFDataArray.m @@ -395,12 +395,12 @@ } } - (void)removeLastItem { - if (count < 1) - @throw [OFOutOfRangeException exceptionWithClass: [self class]]; + if (count == 0) + return; count--; @try { data = [self resizeMemory: data size: itemSize @@ -661,12 +661,12 @@ - (void)removeLastItem { size_t newSize, lastPageByte; - if (count < 1) - @throw [OFOutOfRangeException exceptionWithClass: [self class]]; + if (count == 0) + return; count--; lastPageByte = of_pagesize - 1; newSize = (count * itemSize + lastPageByte) & ~lastPageByte; Index: src/OFMutableArray.m ================================================================== --- src/OFMutableArray.m +++ src/OFMutableArray.m @@ -300,12 +300,14 @@ - (void)removeLastObject { size_t count = [self count]; - if (count > 0) - [self removeObjectAtIndex: count - 1]; + if (count == 0) + return; + + [self removeObjectAtIndex: count - 1]; } - (void)removeAllObjects { [self removeObjectsInRange: of_range(0, [self count])]; Index: src/OFMutableArray_adjacent.m ================================================================== --- src/OFMutableArray_adjacent.m +++ src/OFMutableArray_adjacent.m @@ -195,11 +195,17 @@ } } - (void)removeLastObject { - id object = [self objectAtIndex: [array count] - 1]; + size_t count = [array count]; + id object; + + if (count == 0) + return; + + object = [self objectAtIndex: count - 1]; [array removeLastItem]; [object release]; mutations++; }