diff --git a/Tusker/Screens/Timeline/TimelineViewController.swift b/Tusker/Screens/Timeline/TimelineViewController.swift index e6620bc7..8ca57ed8 100644 --- a/Tusker/Screens/Timeline/TimelineViewController.swift +++ b/Tusker/Screens/Timeline/TimelineViewController.swift @@ -315,7 +315,7 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro } else { // I'm not sure whether this should move into TimelineLikeController/TimelineLikeCollectionViewController let (_, presentItems) = await (controller.loadNewer(), try? loadInitial()) - if let presentItems { + if let presentItems, !presentItems.isEmpty { insertPresentItemsIfNecessary(presentItems) } } @@ -334,6 +334,9 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro private func insertPresentItemsIfNecessary(_ presentItems: [String]) { var snapshot = dataSource.snapshot() + guard snapshot.indexOfSection(.statuses) != nil else { + return + } let currentItems = snapshot.itemIdentifiers(inSection: .statuses) if case .status(id: let firstID, state: _) = currentItems.first, // if there's no overlap between presentItems and the existing items in the data source, insert the present items and prompt the user