forked from shadowfacts/Tusker
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
|
selectionChangedFeedbackGenerator = nil
|
||||||
|
|
||||||
hide() {
|
hide() {
|
||||||
(self.view.window!.windowScene!.delegate as! MainSceneDelegate).showAddAccount()
|
if let sceneDelegate = self.view.window?.windowScene?.delegate as? MainSceneDelegate {
|
||||||
|
sceneDelegate.showAddAccount()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let account = UserAccountsManager.shared.accounts[newIndex - 1]
|
let account = UserAccountsManager.shared.accounts[newIndex - 1]
|
||||||
|
@ -178,7 +180,9 @@ class FastAccountSwitcherViewController: UIViewController {
|
||||||
selectionChangedFeedbackGenerator = nil
|
selectionChangedFeedbackGenerator = nil
|
||||||
|
|
||||||
hide() {
|
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 {
|
} else {
|
||||||
hide()
|
hide()
|
||||||
|
|
Loading…
Reference in New Issue