mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-24 14:48:07 +00:00
Fix missing null check
This commit is contained in:
parent
0d330c9ab6
commit
76ff76e181
1 changed files with 13 additions and 11 deletions
|
|
@ -294,17 +294,19 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe
|
|||
NSString* username = CFDictionaryGetValue(lDict, kABPersonInstantMessageUsernameKey);
|
||||
LinphoneAddress* address = linphone_core_interpret_url([LinphoneManager getLc]
|
||||
,[username UTF8String]);
|
||||
char* uri = linphone_address_as_string_uri_only(address);
|
||||
CFStringRef keys[] = { kABPersonInstantMessageUsernameKey, kABPersonInstantMessageServiceKey};
|
||||
CFTypeRef values[] = { [NSString stringWithCString:uri encoding:[NSString defaultCStringEncoding]], [LinphoneManager instance].contactSipField };
|
||||
CFDictionaryRef lDict2 = CFDictionaryCreate(NULL, (const void **)&keys, (const void **)&values, 2, NULL, NULL);
|
||||
ABMultiValueReplaceValueAtIndex(lMap, lDict2, index);
|
||||
if (!ABRecordSetValue(contact, kABPersonInstantMessageProperty, lMap, (CFErrorRef*)&error)) {
|
||||
[LinphoneLogger log:LinphoneLoggerLog format:@"Can't set contact with value [%@] cause [%@]", value,[error localizedDescription]];
|
||||
}
|
||||
CFRelease(lDict2);
|
||||
linphone_address_destroy(address);
|
||||
ms_free(uri);
|
||||
if(address){
|
||||
char* uri = linphone_address_as_string_uri_only(address);
|
||||
CFStringRef keys[] = { kABPersonInstantMessageUsernameKey, kABPersonInstantMessageServiceKey};
|
||||
CFTypeRef values[] = { [NSString stringWithCString:uri encoding:[NSString defaultCStringEncoding]], [LinphoneManager instance].contactSipField };
|
||||
CFDictionaryRef lDict2 = CFDictionaryCreate(NULL, (const void **)&keys, (const void **)&values, 2, NULL, NULL);
|
||||
ABMultiValueReplaceValueAtIndex(lMap, lDict2, index);
|
||||
if (!ABRecordSetValue(contact, kABPersonInstantMessageProperty, lMap, (CFErrorRef*)&error)) {
|
||||
[LinphoneLogger log:LinphoneLoggerLog format:@"Can't set contact with value [%@] cause [%@]", value,[error localizedDescription]];
|
||||
}
|
||||
CFRelease(lDict2);
|
||||
linphone_address_destroy(address);
|
||||
ms_free(uri);
|
||||
}
|
||||
}
|
||||
CFRelease(lMap);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue