mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-24 01:38:26 +00:00
Don't assert indexForCell: API when cell isn't visible
Summary: Noticed this randomly debugging. Say you have a completion block that finishes after some async task happens. If you scroll the cell off screen it will return `nil` for `-[UICollectionView indexPathForCell:]`, and the assert will fail (unless the SC is at 0). Quiet some asserts. Closes https://github.com/Instagram/IGListKit/pull/824 Differential Revision: D5303432 Pulled By: rnystrom fbshipit-source-id: 64432c43f46d33ce052e6f4fedc094c1fc1f04e1
This commit is contained in:
parent
95367bb6a4
commit
d0253b705a
1 changed files with 2 additions and 1 deletions
|
|
@ -731,7 +731,8 @@
|
|||
IGParameterAssert(cell != nil);
|
||||
IGParameterAssert(sectionController != nil);
|
||||
NSIndexPath *indexPath = [self.collectionView indexPathForCell:cell];
|
||||
IGAssert(indexPath.section == [self sectionForSectionController:sectionController],
|
||||
IGAssert(indexPath == nil
|
||||
|| indexPath.section == [self sectionForSectionController:sectionController],
|
||||
@"Requesting a cell from another section controller is not allowed.");
|
||||
return indexPath != nil ? indexPath.item : NSNotFound;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue