Verify that the section exists before accessing it so that we don't crash on the new SDK

This commit is contained in:
Maurice Parker 2020-06-28 03:14:53 -05:00
parent 05f259da51
commit 403b859c31
1 changed files with 2 additions and 1 deletions

View File

@ -611,7 +611,8 @@ private extension MasterTimelineViewController {
}
tableView.selectRow(at: nil, animated: false, scrollPosition: .top)
if resetScroll && dataSource.snapshot().itemIdentifiers(inSection: 0).count > 0 {
let dataSourceSnapshot = dataSource.snapshot()
if resetScroll && dataSourceSnapshot.indexOfSection(0) != nil && dataSourceSnapshot.itemIdentifiers(inSection: 0).count > 0 {
tableView.scrollToRow(at: IndexPath(row: 0, section: 0), at: .top, animated: false)
}