forked from shadowfacts/Tusker
Fix potential crash due to race condition in timeline gap filling
This commit is contained in:
parent
af5a0b7bbd
commit
37311e5f17
|
@ -1166,7 +1166,10 @@ extension TimelineViewController {
|
||||||
let addedItems: Bool
|
let addedItems: Bool
|
||||||
|
|
||||||
let statusItems = snapshot.itemIdentifiers(inSection: .statuses)
|
let statusItems = snapshot.itemIdentifiers(inSection: .statuses)
|
||||||
let gapIndex = statusItems.firstIndex(of: .gap)!
|
guard let gapIndex = statusItems.firstIndex(of: .gap) else {
|
||||||
|
// Not sure how this is reachable (maybe the gap cell was tapped twice and the requests raced?) but w/e
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
switch direction {
|
switch direction {
|
||||||
case .above:
|
case .above:
|
||||||
|
@ -1293,6 +1296,9 @@ extension TimelineViewController: UICollectionViewDelegate {
|
||||||
selected(status: status.reblog?.id ?? id, state: collapseState.copy())
|
selected(status: status.reblog?.id ?? id, state: collapseState.copy())
|
||||||
}
|
}
|
||||||
case .gap:
|
case .gap:
|
||||||
|
guard controller.state == .idle else {
|
||||||
|
return
|
||||||
|
}
|
||||||
let cell = collectionView.cellForItem(at: indexPath) as! TimelineGapCollectionViewCell
|
let cell = collectionView.cellForItem(at: indexPath) as! TimelineGapCollectionViewCell
|
||||||
cell.showsIndicator = true
|
cell.showsIndicator = true
|
||||||
Task {
|
Task {
|
||||||
|
|
Loading…
Reference in New Issue