diff --git a/Tusker/Screens/Timeline/TimelineViewController.swift b/Tusker/Screens/Timeline/TimelineViewController.swift index 07c79163..dc418ecb 100644 --- a/Tusker/Screens/Timeline/TimelineViewController.swift +++ b/Tusker/Screens/Timeline/TimelineViewController.swift @@ -432,8 +432,9 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro } // update the timeline position in case some statuses couldn't be loaded - if let center = position.centerStatusID { - let nearestLoadedStatusToCenter = position.statusIDs[position.statusIDs.firstIndex(of: center)!...].first(where: { id in + if let center = position.centerStatusID, + let centerIndex = position.statusIDs.firstIndex(of: center) { + let nearestLoadedStatusToCenter = position.statusIDs[centerIndex...].first(where: { id in // was already loaded or was just now loaded !unloaded.contains(id) || statuses.contains(where: { $0.id == id }) })