diff --git a/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.m b/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.m index a34964b..c1219b5 100755 --- a/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.m +++ b/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.m @@ -149,7 +149,7 @@ - (void)invalidateLayoutIfNecessary { NSIndexPath *newIndexPath = [self.collectionView indexPathForItemAtPoint:self.currentView.center]; NSIndexPath *previousIndexPath = self.selectedItemIndexPath; - if ((newIndexPath == nil) || [newIndexPath isEqual:previousIndexPath]) { + if ((newIndexPath == nil) || (previousIndexPath == nil) || [newIndexPath isEqual:previousIndexPath]) { return; }