Workaround for crash when pressing Cmd+1/2/... on macOS

See #253

The actions won't work, but it's better than crashing :/
This commit is contained in:
Shadowfacts 2022-11-29 23:19:19 -05:00
parent f1a39c2faa
commit 948eff1f7e
1 changed files with 5 additions and 1 deletions

View File

@ -101,7 +101,11 @@ class MainSplitViewController: UISplitViewController {
} }
} }
@objc func handleSidebarItemCommand(_ command: UICommand) { @objc func handleSidebarItemCommand(_ sender: AnyObject) {
// workaround for crash when sender is not a UICommand, see #253 and FB11804009
guard let command = sender as? UICommand else {
return
}
let item: MainSidebarViewController.Item let item: MainSidebarViewController.Item
if let index = command.propertyList as? Int { if let index = command.propertyList as? Int {
item = .tab(MainTabBarViewController.Tab(rawValue: index)!) item = .tab(MainTabBarViewController.Tab(rawValue: index)!)