Skip to content

Commit 9ce238a

Browse files
authored
Merge pull request #1313 from kif-framework/markj/collection_view_remove_assert
Skip cells that can’t be found
2 parents be806f7 + d8b6ef6 commit 9ce238a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Sources/KIF/Additions/UIView-KIFAdditions.m

+4-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,10 @@ - (UIAccessibilityElement *)accessibilityElementMatchingBlock:(BOOL(^)(UIAccessi
385385
[collectionView layoutIfNeeded];
386386
cell = [collectionView cellForItemAtIndexPath:indexPath];
387387
}
388-
NSAssert(cell, @"UICollectionViewCell returned from 'cellForItemAtIndexPath' is unexpectedly nil!");
388+
// Skip this cell if it can't be found
389+
if (!cell) {
390+
continue;
391+
}
389392
UIAccessibilityElement *element = [cell accessibilityElementMatchingBlock:matchBlock notHidden:NO disableScroll:NO];
390393

391394
// Skip this cell if it isn't the one we're looking for

0 commit comments

Comments
 (0)