Skip to content

Crash when dragging off end of table #22

@GeorgeSealy

Description

@GeorgeSealy

To reproduce:

  • implement tableView: targetIndexPathForMoveFromRowAtIndexPath: toProposedIndexPath: in table view delegate
  • try to drag off the bottom of the table
  • crash

The crash is in HPReorderTableView.m, - (void)updateCurrentLocation:(UILongPressGestureRecognizer *)gesture. toIndexPath is nil which results in a crash. A possible fix is:

if ([self.delegate respondsToSelector:@selector(tableView:targetIndexPathForMoveFromRowAtIndexPath:toProposedIndexPath:)])
{
    if (toIndexPath == nil) {
        return;
    }
        
    toIndexPath = [self.delegate tableView:self targetIndexPathForMoveFromRowAtIndexPath:_reorderInitialIndexPath toProposedIndexPath:toIndexPath];
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions