Fix crash while cancelling prefetching of rows

This commit is contained in:
Shadowfacts 2020-12-31 23:20:53 -05:00
parent 3fdeb51353
commit f0e2bb8db6
1 changed files with 3 additions and 3 deletions

View File

@ -134,11 +134,11 @@ class TimelineLikeTableViewController<Item>: EnhancedTableViewController, Refres
}
willRemoveRows(at: indexPathsToRemove)
sections.removeSubrange(sectionsToRemove)
UIView.performWithoutAnimation {
tableView.deleteSections(IndexSet(sectionsToRemove), with: .none)
}
sections.removeSubrange(sectionsToRemove)
} else if lastVisibleRow.section == lastSectionIndex {
let lastSection = sections.last!
let lastRowIndex = lastSection.count - 1
@ -146,7 +146,7 @@ class TimelineLikeTableViewController<Item>: EnhancedTableViewController, Refres
if lastVisibleRow.row < lastRowIndex - pageSize {
// if there are more than pageSize rows in the current section below the last visible one
let rowIndicesInLastSectionToRemove = (lastVisibleRow.row + 20)..<lastSection.count
let rowIndicesInLastSectionToRemove = (lastVisibleRow.row + pageSize)..<lastSection.count
let indexPathsToRemove = rowIndicesInLastSectionToRemove.map {
IndexPath(row: $0, section: lastSectionIndex)