mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 23:32:41 +00:00
Fix crash with sections
This commit is contained in:
parent
b34382f7f7
commit
8a619e27da
1 changed files with 5 additions and 1 deletions
|
@ -2194,11 +2194,15 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro
|
|||
cellData = [self.dataSource cellDataAtIndexPath:nextIndexPath];
|
||||
}
|
||||
|
||||
if (!cellData && [self.recentsTableView numberOfRowsInSection:section] > 0)
|
||||
if (!cellData && section < self.recentsTableView.numberOfSections && [self.recentsTableView numberOfRowsInSection:section] > 0)
|
||||
{
|
||||
// Scroll back to the top.
|
||||
[self.recentsTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:section] atScrollPosition:UITableViewScrollPositionTop animated:YES];
|
||||
}
|
||||
else if (section >= self.recentsTableView.numberOfSections)
|
||||
{
|
||||
MXLogFailure(@"[RecentsViewController] Section %ld is invalid in a table view with only %ld sections", section, self.recentsTableView.numberOfSections);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue