From 6fae0850e898d64fe068b231089f8fc21e17ae99 Mon Sep 17 00:00:00 2001 From: Rustem Mussabekov Date: Tue, 26 Oct 2021 11:49:15 +0300 Subject: [PATCH] Fixes Unexpectedly Found Nil When Unwrapping Optional in WebAuthenticationPresenter This pull request fixes the unexpectedly found nil when unwrapping optional by using ASPresentationAnchor() for iOS 13+ and MacOS 10.15+, otherwise defaults to original behavior. --- .../WebAuthenticationSession/WebAuthenticationPresenter.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/BetterSafariView/WebAuthenticationSession/WebAuthenticationPresenter.swift b/Sources/BetterSafariView/WebAuthenticationSession/WebAuthenticationPresenter.swift index ec664c6..bbe7552 100644 --- a/Sources/BetterSafariView/WebAuthenticationSession/WebAuthenticationPresenter.swift +++ b/Sources/BetterSafariView/WebAuthenticationSession/WebAuthenticationPresenter.swift @@ -179,7 +179,7 @@ extension WebAuthenticationPresenter { // MARK: ASWebAuthenticationPresentationContextProviding func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor { - return coordinator.view.window! + return coordinator.view.window ?? ASPresentationAnchor() } }