Skip to content

Commit

Permalink
Skip cells that can’t be found
Browse files Browse the repository at this point in the history
  • Loading branch information
mjohnson12 committed Nov 27, 2024
1 parent be806f7 commit d8b6ef6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Sources/KIF/Additions/UIView-KIFAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,10 @@ - (UIAccessibilityElement *)accessibilityElementMatchingBlock:(BOOL(^)(UIAccessi
[collectionView layoutIfNeeded];
cell = [collectionView cellForItemAtIndexPath:indexPath];
}
NSAssert(cell, @"UICollectionViewCell returned from 'cellForItemAtIndexPath' is unexpectedly nil!");
// Skip this cell if it can't be found
if (!cell) {
continue;
}
UIAccessibilityElement *element = [cell accessibilityElementMatchingBlock:matchBlock notHidden:NO disableScroll:NO];

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

0 comments on commit d8b6ef6

Please sign in to comment.