Skip to content

Commit

Permalink
Merge pull request #98 from Coeur/nonRecursiveRootViewController
Browse files Browse the repository at this point in the history
fixing infinite recursion where the first window is a ToastWindow itself
  • Loading branch information
devxoul authored Feb 16, 2017
2 parents 1f59d79 + 06694b5 commit de40f1a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/ToastWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ open class ToastWindow: UIWindow {
override open var rootViewController: UIViewController? {
get {
guard !self.isStatusBarOrientationChanging else { return nil }
return UIApplication.shared.windows.first?.rootViewController
guard let firstWindow = UIApplication.shared.windows.first else { return nil }
return firstWindow is ToastWindow ? nil : firstWindow.rootViewController
}
set { /* Do nothing */ }
}
Expand Down

0 comments on commit de40f1a

Please sign in to comment.