Bladeren bron

handle exceptions from resumeExternalUserAgentFlowWithURL

Camden King 6 maanden geleden
bovenliggende
commit
680698574e
1 gewijzigde bestanden met toevoegingen van 9 en 5 verwijderingen
  1. 9 5
      GoogleSignIn/Sources/GIDSignIn.m

+ 9 - 5
GoogleSignIn/Sources/GIDSignIn.m

@@ -197,11 +197,15 @@ static NSString *const kConfigOpenIDRealmKey = @"GIDOpenIDRealm";
 - (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]) {