diff --git a/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.m b/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.m index 9688aad..fcaf0ce 100755 --- a/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.m +++ b/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.m @@ -300,6 +300,10 @@ - (void)handleLongPressGesture:(UILongPressGestureRecognizer *)gestureRecognizer case UIGestureRecognizerStateBegan: { NSIndexPath *currentIndexPath = [self.collectionView indexPathForItemAtPoint:[gestureRecognizer locationInView:self.collectionView]]; + if (currentIndexPath == nil) { + return; + } + if ([self.dataSource respondsToSelector:@selector(collectionView:canMoveItemAtIndexPath:)] && ![self.dataSource collectionView:self.collectionView canMoveItemAtIndexPath:currentIndexPath]) { return;