diff --git a/Tusker/Screens/Timeline/TimelineViewController.swift b/Tusker/Screens/Timeline/TimelineViewController.swift index 48160fd4..9a4b208c 100644 --- a/Tusker/Screens/Timeline/TimelineViewController.swift +++ b/Tusker/Screens/Timeline/TimelineViewController.swift @@ -621,9 +621,12 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro snapshot.insertItems(presentItems.map { .status(id: $0, collapseState: .unknown, filterState: .unknown) }, beforeItem: .gap) if applySnapshotBeforeScrolling { - let firstVisibleIndexPath = collectionView.indexPathsForVisibleItems.min()! - let firstVisibleItem = dataSource.itemIdentifier(for: firstVisibleIndexPath)! - applySnapshot(snapshot, maintainingBottomRelativeScrollPositionOf: firstVisibleItem) + if let firstVisibleIndexPath = collectionView.indexPathsForVisibleItems.min() { + let firstVisibleItem = dataSource.itemIdentifier(for: firstVisibleIndexPath)! + applySnapshot(snapshot, maintainingBottomRelativeScrollPositionOf: firstVisibleItem) + } else { + dataSource.apply(snapshot, animatingDifferences: false) + } } var config = ToastConfiguration(title: "Jump to Present")