Ensure that the snapshot has items in it before testing section zero.

This commit is contained in:
Maurice Parker 2020-10-17 20:06:53 -05:00
parent a1cb184fcb
commit d1b8ac06af
1 changed files with 5 additions and 3 deletions

View File

@ -611,12 +611,14 @@ private extension MasterTimelineViewController {
}
tableView.selectRow(at: nil, animated: false, scrollPosition: .top)
if resetScroll && dataSource.snapshot().itemIdentifiers(inSection: 0).count > 0 {
tableView.scrollToRow(at: IndexPath(row: 0, section: 0), at: .top, animated: false)
if resetScroll {
let snapshot = dataSource.snapshot()
if snapshot.sectionIdentifiers.count > 0 && snapshot.itemIdentifiers(inSection: 0).count > 0 {
tableView.scrollToRow(at: IndexPath(row: 0, section: 0), at: .top, animated: false)
}
}
updateToolbar()
}
func updateToolbar() {