From 23f9e200dc472a77075c6b140904a012c3f38183 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Thu, 24 Nov 2022 12:14:19 -0500 Subject: [PATCH] Fix potential crash when trying to save timeline state --- 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 1ab2f7fe31..e6620bc789 100644 --- a/Tusker/Screens/Timeline/TimelineViewController.swift +++ b/Tusker/Screens/Timeline/TimelineViewController.swift @@ -184,6 +184,9 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro } func stateRestorationActivity() -> NSUserActivity? { + guard isViewLoaded else { + return nil + } let visible = collectionView.indexPathsForVisibleItems.sorted() let snapshot = dataSource.snapshot() let visibleRect = CGRect(origin: collectionView.contentOffset, size: collectionView.bounds.size)