diff --git a/Tusker/Screens/Main/MainSplitViewController.swift b/Tusker/Screens/Main/MainSplitViewController.swift index a66a0c45..105c534c 100644 --- a/Tusker/Screens/Main/MainSplitViewController.swift +++ b/Tusker/Screens/Main/MainSplitViewController.swift @@ -139,7 +139,9 @@ extension MainSplitViewController: UISplitViewControllerDelegate { // 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 - transferNavigationStack(from: .tab(tab), to: tabNav) + if tabNav.isViewLoaded { + transferNavigationStack(from: .tab(tab), to: tabNav) + } } // Since several sidebar items map to the single Explore tab, we only transfer the @@ -235,7 +237,8 @@ extension MainSplitViewController: UISplitViewControllerDelegate { // For each sidebar item, transfer the existing navigation stasck from the tab bar controller to ourself. var exploreItem: MainSidebarViewController.Item? for tab in MainTabBarViewController.Tab.allCases { - guard let tabNavController = tabBarViewController.viewController(for: tab) as? UINavigationController else { continue } + guard let tabNavController = tabBarViewController.viewController(for: tab) as? UINavigationController, + tabNavController.isViewLoaded else { continue } let tabNavigationStack = tabNavController.viewControllers switch tab {