Fix crash when TimelinePosition's center status ID isn't in the list of IDs
This commit is contained in:
parent
c03fc86300
commit
468a559127
|
@ -432,8 +432,9 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the timeline position in case some statuses couldn't be loaded
|
// update the timeline position in case some statuses couldn't be loaded
|
||||||
if let center = position.centerStatusID {
|
if let center = position.centerStatusID,
|
||||||
let nearestLoadedStatusToCenter = position.statusIDs[position.statusIDs.firstIndex(of: center)!...].first(where: { id in
|
let centerIndex = position.statusIDs.firstIndex(of: center) {
|
||||||
|
let nearestLoadedStatusToCenter = position.statusIDs[centerIndex...].first(where: { id in
|
||||||
// was already loaded or was just now loaded
|
// was already loaded or was just now loaded
|
||||||
!unloaded.contains(id) || statuses.contains(where: { $0.id == id })
|
!unloaded.contains(id) || statuses.contains(where: { $0.id == id })
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue