forked from shadowfacts/Tusker
Fix crash while cancelling prefetching of rows
This commit is contained in:
parent
3fdeb51353
commit
f0e2bb8db6
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue