From daa1a9eef7846db1a3a10b6264f6a2fbc18aa963 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 25 Apr 2021 12:39:45 -0400 Subject: [PATCH] Fix potential crash when collapsing w/o selected sidebar item --- Tusker/Screens/Main/MainSplitViewController.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Tusker/Screens/Main/MainSplitViewController.swift b/Tusker/Screens/Main/MainSplitViewController.swift index a04d74f6..49f7cd69 100644 --- a/Tusker/Screens/Main/MainSplitViewController.swift +++ b/Tusker/Screens/Main/MainSplitViewController.swift @@ -164,7 +164,10 @@ extension MainSplitViewController: UISplitViewControllerDelegate { } // Switch the tab bar to focus the same item as the sidebar has selected - switch sidebar.selectedItem! { + switch sidebar.selectedItem { + case nil: + break + case let .tab(tab): // sidebar items that map 1 <-> 1 can be transferred directly tabBarViewController.select(tab: tab)