alikaragoz / MCSwipeTableViewCell

:point_up_2: Convenient UITableViewCell subclass that implements a swippable content to trigger actions (similar to the Mailbox app).
MIT License
2.96k stars 412 forks source link

Crashes when repeatedly swiping to delete a cell #22

Closed sarperdag closed 11 years ago

sarperdag commented 11 years ago

Try repeatedly swiping to delete a cell. If you do it fast enough before the delete animation finishes, it crashes... Any ideas how to fix this?

Here is the log:

2013-08-31 22:56:05.098 MCSwipe Demo[10639:907] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]' *\ First throw call stack:

sarperdag commented 11 years ago

Never mind, fixed it like this, but you might wanna fix it in the demo too..

- (void)swipeTableViewCell:(MCSwipeTableViewCell *)cell didTriggerState:(MCSwipeTableViewCellState)state     withMode:(MCSwipeTableViewCellMode)mode {

if (mode == MCSwipeTableViewCellModeExit) {
    NSIndexPath *path = [someTableView indexPathForCell:cell];
    if (!path) {
        return;
    }

..