Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Commit

Permalink
Merge pull request #11 from jedlinlau/master
Browse files Browse the repository at this point in the history
In SimpleAuthWrapper.m, check for nil error userInfo or errorString
  • Loading branch information
adamjmcgrath committed Aug 5, 2015
2 parents e2f3a75 + 3396342 commit 9423d32
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions iOS/SimpleAuthWrapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,18 @@ @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]);
Expand Down

0 comments on commit 9423d32

Please sign in to comment.