Skip to content

Commit

Permalink
Fix recently introduced social profile crash
Browse files Browse the repository at this point in the history
Cause of the crash: trying to initialize `NSURL` with `nil` value. This is introduced in
e06316a.

This is the message after crash:

```
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL
initWithString:relativeToURL:]: nil string parameter'
```
  • Loading branch information
dduan committed Jan 6, 2017
1 parent c6bc63d commit e46c7ef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Pod/Core/Private/Extractors/APContactDataExtractor.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ - (NSArray *)socialProfiles
NSString *socialService = dictionary[(__bridge NSString *)kABPersonSocialProfileServiceKey];
profile.socialNetwork = [APSocialServiceHelper socialNetworkTypeWithString:socialService];
NSString *urlString = dictionary[(__bridge NSString *)kABPersonSocialProfileURLKey];
profile.url = [[NSURL alloc] initWithString:urlString];
if (urlString)
{
profile.url = [[NSURL alloc] initWithString:urlString];
}
profile.username = dictionary[(__bridge NSString *)kABPersonSocialProfileUsernameKey];
profile.userIdentifier = dictionary[(__bridge NSString *)kABPersonSocialProfileUserIdentifierKey];
[profiles addObject:profile];
Expand Down

0 comments on commit e46c7ef

Please sign in to comment.