From 680698574e1ca68c3bed9dbe1b5365a684581b4f Mon Sep 17 00:00:00 2001 From: Camden King Date: Thu, 18 Sep 2025 16:27:16 -0700 Subject: [PATCH] handle exceptions from resumeExternalUserAgentFlowWithURL --- GoogleSignIn/Sources/GIDSignIn.m | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/GoogleSignIn/Sources/GIDSignIn.m b/GoogleSignIn/Sources/GIDSignIn.m index 1c043735..d4e81b39 100644 --- a/GoogleSignIn/Sources/GIDSignIn.m +++ b/GoogleSignIn/Sources/GIDSignIn.m @@ -197,11 +197,15 @@ @implementation GIDSignIn { - (BOOL)handleURL:(NSURL *)url { // Check if the callback path matches the expected one for a URL from Safari/Chrome/SafariVC. if ([url.path isEqual:kBrowserCallbackPath]) { - if ([_currentAuthorizationFlow resumeExternalUserAgentFlowWithURL:url]) { - _currentAuthorizationFlow = nil; - return YES; - } - return NO; + @try { + if ([_currentAuthorizationFlow resumeExternalUserAgentFlowWithURL:url]) { + _currentAuthorizationFlow = nil; + return YES; + } + return NO; + } @catch (NSException *exception) { + return NO; + } } // Check if the callback path matches the expected one for a URL from Google Device Policy app. if ([url.path isEqual:kEMMCallbackPath]) {