Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random crash when calling ActionSheetDialog #103

Closed
victorlsn opened this issue May 12, 2017 · 3 comments
Closed

Random crash when calling ActionSheetDialog #103

victorlsn opened this issue May 12, 2017 · 3 comments

Comments

@victorlsn
Copy link

Sometimes when I try to call a ActionSheetDialog on my app, the app crashes.
As I don't know what causes the crash (sometimes it happens, sometimes it doesn't) I can't reproduce it with precision. But the part of the code that is crashing the app is in the Toaster Library, on this part:

override open var rootViewController: UIViewController? {
get {
guard !self.isStatusBarOrientationChanging else { return nil }
guard let firstWindow = UIApplication.shared.windows.first else { return nil }
return firstWindow is ToastWindow ? nil : firstWindow.rootViewController
}
set { /* Do nothing */ }
}

More specifically, it's on this line
guard let firstWindow = UIApplication.shared.windows.first else { return nil }

Do you guys have any idea of what could be causing this? Sorry for being so vague but I really have no idea of how to reproduce it and gather more info.

@victorlsn victorlsn changed the title Random crash when calling Random crash when calling ActionSheetDialog May 12, 2017
@victorlsn
Copy link
Author

I believe this is related to this pull:
#98

@devxoul
Copy link
Owner

devxoul commented May 16, 2017

@victorlsn, can you try with the code:

- guard let firstWindow = UIApplication.shared.windows.first else { return nil }
+ guard let firstWindow = UIApplication.shared.delegate?.window ?? nil else { return nil }

@devxoul
Copy link
Owner

devxoul commented Jun 12, 2017

Fixed in #106

@devxoul devxoul closed this as completed Jun 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants