From 365978b289254f6693e98fe152e7c3e314c46de1 Mon Sep 17 00:00:00 2001 From: Jed Lau Date: Wed, 5 Aug 2015 09:26:25 -0700 Subject: [PATCH 1/2] In SimpleAuthWrapper.m, check for nil userInfo or errorString. --- iOS/SimpleAuthWrapper.m | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/iOS/SimpleAuthWrapper.m b/iOS/SimpleAuthWrapper.m index c631d8e..a2e3d62 100644 --- a/iOS/SimpleAuthWrapper.m +++ b/iOS/SimpleAuthWrapper.m @@ -32,16 +32,23 @@ @implementation SimpleAuthWrapper callback(@[[NSNull null], token, [extra objectForKey: @"raw_info"]]); } else { if (error) { + NSMutableDictionary *dict=[NSMutableDictionary dictionaryWithCapacity:1]; + [dict setObject:[NSNumber numberWithInteger:error.code] forKey:@"code"]; + + // Add an error description, if it exists. NSDictionary *userInfo = [error userInfo]; - NSString *errorString = [[userInfo objectForKey:NSUnderlyingErrorKey] localizedDescription]; - NSDictionary *dict=@{@"code": [NSNumber numberWithInteger:error.code], - @"description": errorString}; + if (userInfo) { + NSString *errorString = [[userInfo objectForKey:NSUnderlyingErrorKey] localizedDescription]; + if (errorString) { + [dict setObject:errorString forKey:@"description"]; + } + } + callback(@[dict]); } else { callback(@[@true]); } } - }]; } From 3396342975831861f8fca3fc930291b14d730ff8 Mon Sep 17 00:00:00 2001 From: Jed Lau Date: Wed, 5 Aug 2015 09:30:49 -0700 Subject: [PATCH 2/2] revert whitespace change --- iOS/SimpleAuthWrapper.m | 1 + 1 file changed, 1 insertion(+) diff --git a/iOS/SimpleAuthWrapper.m b/iOS/SimpleAuthWrapper.m index a2e3d62..d74350b 100644 --- a/iOS/SimpleAuthWrapper.m +++ b/iOS/SimpleAuthWrapper.m @@ -49,6 +49,7 @@ @implementation SimpleAuthWrapper callback(@[@true]); } } + }]; }