Skip to content

Commit 95d08f0

Browse files
Merge branch 'master' of github.com:AlanQuatermain/AQGridView
* 'master' of github.com:AlanQuatermain/AQGridView: fixing crash while deleting last grid item
2 parents ad02112 + 5ff7848 commit 95d08f0

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Classes/AQGridView.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,6 +1510,15 @@ - (void) updateVisibleGridCellsNow
15101510
[shifted shiftIndexesStartingAtIndex: [removedIndices firstIndex] by: 0 - (NSInteger)_visibleIndices.location];
15111511
//NSLog( @"Removed indices relative to visible cell list: %@", shifted );
15121512

1513+
NSUInteger index=[shifted firstIndex];
1514+
while(index != NSNotFound){
1515+
NSLog(@"%i >= %i ?", index, [_visibleCells count]);
1516+
if (index >= [_visibleCells count]) {
1517+
[shifted removeIndex:index];
1518+
}
1519+
index=[shifted indexGreaterThanIndex: index];
1520+
}
1521+
15131522
// pull out the cells for manipulation
15141523
NSMutableArray * removedCells = [[_visibleCells objectsAtIndexes: shifted] mutableCopy];
15151524

0 commit comments

Comments
 (0)