Fix crash if window removed while fast account switcher is hiding
This commit is contained in:
parent
16f6dc84c9
commit
13809b91d1
|
@ -166,7 +166,9 @@ class FastAccountSwitcherViewController: UIViewController {
|
|||
selectionChangedFeedbackGenerator = nil
|
||||
|
||||
hide() {
|
||||
(self.view.window!.windowScene!.delegate as! MainSceneDelegate).showAddAccount()
|
||||
if let sceneDelegate = self.view.window?.windowScene?.delegate as? MainSceneDelegate {
|
||||
sceneDelegate.showAddAccount()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let account = UserAccountsManager.shared.accounts[newIndex - 1]
|
||||
|
@ -178,7 +180,9 @@ class FastAccountSwitcherViewController: UIViewController {
|
|||
selectionChangedFeedbackGenerator = nil
|
||||
|
||||
hide() {
|
||||
(self.view.window!.windowScene!.delegate as! MainSceneDelegate).activateAccount(account, animated: true)
|
||||
if let sceneDelegate = self.view.window?.windowScene?.delegate as? MainSceneDelegate {
|
||||
sceneDelegate.activateAccount(account, animated: true)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
hide()
|
||||
|
|
Loading…
Reference in New Issue