Skip to content

Commit

Permalink
Merge pull request Tencent#436 from wbcyclist/patch-2
Browse files Browse the repository at this point in the history
[fix] scrollToRowAtIndexPath 中 indexPath 是否合法的判断
  • Loading branch information
MoLice authored Nov 21, 2018
2 parents 14e9ef7 + fe059c0 commit 0725bb2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions QMUIKit/UIKitExtensions/UITableView+QMUI.m
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ - (void)qmui_scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(U
NSInteger numberOfSections = [self numberOfSections];
if (indexPath.section >= numberOfSections) {
isIndexPathLegal = NO;
} else {
} else if (indexPath.row != NSNotFound) {
NSInteger rows = [self numberOfRowsInSection:indexPath.section];
isIndexPathLegal = rows > 0 ? indexPath.row < rows : indexPath.row == NSNotFound;
isIndexPathLegal = indexPath.row < rows;
}
if (!isIndexPathLegal) {
QMUILogWarn(@"UITableView (QMUI)", @"%@ - target indexPath : %@ ,不合法的indexPath。\n%@", self, indexPath, [NSThread callStackSymbols]);
Expand Down

0 comments on commit 0725bb2

Please sign in to comment.