Fix crash on launch due to unloaded sidebar VC

This commit is contained in:
Shadowfacts 2020-08-15 13:53:10 -04:00
parent 260bedcf10
commit f9b85c87b4
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 3 additions and 0 deletions

View File

@ -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