From f9b85c87b4993b802755d725ece19acf0e1b9c4d Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 15 Aug 2020 13:53:10 -0400 Subject: [PATCH] Fix crash on launch due to unloaded sidebar VC --- Tusker/Screens/Main/MainSplitViewController.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Tusker/Screens/Main/MainSplitViewController.swift b/Tusker/Screens/Main/MainSplitViewController.swift index 5ce25b2e..fba38a14 100644 --- a/Tusker/Screens/Main/MainSplitViewController.swift +++ b/Tusker/Screens/Main/MainSplitViewController.swift @@ -98,6 +98,9 @@ extension MainSplitViewController: UISplitViewControllerDelegate { } func splitViewControllerDidCollapse(_ svc: UISplitViewController) { + // on iPhones, the sidebar VC is never loaded, but since this method is still called, we can't do anything + guard sidebar.isViewLoaded else { return } + // Transfer the nav stacks for all the sidebar items that map 1 <-> 1 with tabs for tab in [MainTabBarViewController.Tab.timelines, .notifications, .myProfile] { let tabNav = tabBarViewController.viewController(for: tab) as! UINavigationController