diff --git a/Source/IGListKit/IGListCollectionViewLayout.mm b/Source/IGListKit/IGListCollectionViewLayout.mm index c8dacbc44..16266780e 100644 --- a/Source/IGListKit/IGListCollectionViewLayout.mm +++ b/Source/IGListKit/IGListCollectionViewLayout.mm @@ -279,6 +279,10 @@ - (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSInde return attributes; } + if (indexPath == nil) { + return nil; + } + // avoid OOB errors const NSInteger section = indexPath.section; const NSInteger item = indexPath.item; @@ -474,7 +478,7 @@ - (NSString *)_classNameForDelegate:(id)dele - (void)_calculateLayoutIfNeeded { if (_minimumInvalidatedSection == NSNotFound) { return; - } + } UICollectionView *collectionView = self.collectionView; id delegate = (id)collectionView.delegate;