bjhomer / HSImageSidebarView

A view based on the sidebar in Apple's Keynote app for iPad.
MIT License
280 stars 39 forks source link

Crash when non existing box is selected to delete. #1

Closed piobyz closed 13 years ago

piobyz commented 13 years ago

I deleted all boxes and was able to select a row where there was no box any longer. Trying to delete this selection caused crash. Quick and dirty check should prevent this case from crashing: if (selectedIndex != -1 && selectedIndex.row <= [colors count])

2011-06-14 09:58:39.957 Sidebar[2575:207] * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSMutableArray removeObjectAtIndex:]: index 3 beyond bounds for empty array' * Call stack at first throw: ( 0 CoreFoundation 0x00f325a9 exceptionPreprocess + 185 1 libobjc.A.dylib 0x01086313 objc_exception_throw + 44 2 CoreFoundation 0x00f2b49f -[__NSArrayM removeObjectAtIndex:] + 415 3 Sidebar 0x0000226a -[SidebarViewController deleteSelection:] + 186 4 UIKit 0x001844fd -[UIApplication sendAction:to:from:forEvent:] + 119 5 UIKit 0x00214799 -[UIControl sendAction:to:forEvent:] + 67 6 UIKit 0x00216c2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527 7 UIKit 0x002157d8 -[UIControl touchesEnded:withEvent:] + 458 8 UIKit 0x001a8ded -[UIWindow _sendTouchesForEvent:] + 567 9 UIKit 0x00189c37 -[UIApplication sendEvent:] + 447 10 UIKit 0x0018ef2e _UIApplicationHandleEvent + 7576 11 GraphicsServices 0x01a7a992 PurpleEventCallback + 1550 12 CoreFoundation 0x00f13944 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION** + 52 13 CoreFoundation 0x00e73cf7 CFRunLoopDoSource1 + 215 14 CoreFoundation 0x00e70f83 __CFRunLoopRun + 979 15 CoreFoundation 0x00e70840 CFRunLoopRunSpecific + 208 16 CoreFoundation 0x00e70761 CFRunLoopRunInMode + 97 17 GraphicsServices 0x01a791c4 GSEventRunModal + 217 18 GraphicsServices 0x01a79289 GSEventRun + 115 19 UIKit 0x00192c93 UIApplicationMain + 1160 20 Sidebar 0x00001b7e main + 126 21 Sidebar 0x00001af5 start + 53 )

bjhomer commented 13 years ago

Thanks, I'll look into this.