forked from shadowfacts/Tusker
Fix crash when inserting present items in empty timeline
This commit is contained in:
parent
dd6813c058
commit
c6043d60ee
|
@ -719,7 +719,11 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
// there is no existing gap
|
// there is no existing gap
|
||||||
applySnapshotBeforeScrolling = true
|
applySnapshotBeforeScrolling = true
|
||||||
}
|
}
|
||||||
snapshot.insertItems([.gap], beforeItem: currentItems.first!)
|
if let first = currentItems.first {
|
||||||
|
snapshot.insertItems([.gap], beforeItem: first)
|
||||||
|
} else {
|
||||||
|
snapshot.appendItems([.gap], toSection: .statuses)
|
||||||
|
}
|
||||||
snapshot.insertItems(presentItems.map { .status(id: $0, collapseState: .unknown, filterState: .unknown) }, beforeItem: .gap)
|
snapshot.insertItems(presentItems.map { .status(id: $0, collapseState: .unknown, filterState: .unknown) }, beforeItem: .gap)
|
||||||
|
|
||||||
if applySnapshotBeforeScrolling {
|
if applySnapshotBeforeScrolling {
|
||||||
|
|
Loading…
Reference in New Issue