Skip to content

Commit

Permalink
Handling missing window in presentationAnchor more gracefully to avoi…
Browse files Browse the repository at this point in the history
…d crashing the app
  • Loading branch information
tobihagemann committed Aug 22, 2024
1 parent ef94077 commit c432231
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import AuthenticationServices
import CocoaLumberjackSwift
import CryptomatorCommon
import CryptomatorCommonCore
import Foundation
Expand Down Expand Up @@ -108,7 +109,8 @@ class AccountListViewController: ListViewController<AccountCellContent>, ASWebAu

func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor {
guard let window = UIApplication.shared.windows.first else {
fatalError("No window could be found.")
DDLogInfo("No window could be found as presentation anchor.")
return ASPresentationAnchor()
}
return window
}
Expand Down

0 comments on commit c432231

Please sign in to comment.