From 8cf217d2ba915d60314cc80140ef37956678ccba Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 10 Oct 2022 16:21:08 -0400 Subject: [PATCH] Fix crash when trying to prune rows before statuses have loaded --- Tusker/Screens/Timeline/TimelineViewController.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Tusker/Screens/Timeline/TimelineViewController.swift b/Tusker/Screens/Timeline/TimelineViewController.swift index ccc872d1..b40c2076 100644 --- a/Tusker/Screens/Timeline/TimelineViewController.swift +++ b/Tusker/Screens/Timeline/TimelineViewController.swift @@ -175,6 +175,9 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro return } var snapshot = dataSource.snapshot() + guard snapshot.indexOfSection(.statuses) != nil else { + return + } let items = snapshot.itemIdentifiers(inSection: .statuses) let pageSize = 20 let numberOfPagesToPrune = (items.count - lastVisibleIndexPath.row - 1) / pageSize