Fix crash when trying to prune rows before statuses have loaded

This commit is contained in:
Shadowfacts 2022-10-10 16:21:08 -04:00
parent 7d66117fab
commit 8cf217d2ba
1 changed files with 3 additions and 0 deletions

View File

@ -175,6 +175,9 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
return
}
var snapshot = dataSource.snapshot()
guard snapshot.indexOfSection(.statuses) != nil else {
return
}
let items = snapshot.itemIdentifiers(inSection: .statuses)
let pageSize = 20
let numberOfPagesToPrune = (items.count - lastVisibleIndexPath.row - 1) / pageSize