forked from mirrors/linphone-iphone
liblinphone: fix potential crash when interpretting URLs
This commit is contained in:
parent
60bbcbc944
commit
af1ff6a113
3 changed files with 15 additions and 9 deletions
|
|
@ -40,10 +40,14 @@
|
|||
}
|
||||
}
|
||||
// also add current entry, if not listed
|
||||
const LinphoneAddress *addr = linphone_core_interpret_url([LinphoneManager getLc], filter.UTF8String);
|
||||
char *uri = linphone_address_as_string(addr);
|
||||
NSString *nsuri = [NSString stringWithUTF8String:uri];
|
||||
ms_free(uri);
|
||||
LinphoneAddress *addr = linphone_core_interpret_url([LinphoneManager getLc], filter.UTF8String);
|
||||
NSString *nsuri = filter;
|
||||
if (addr) {
|
||||
char *uri = linphone_address_as_string(addr);
|
||||
nsuri = [NSString stringWithUTF8String:uri];
|
||||
ms_free(uri);
|
||||
linphone_address_destroy(addr);
|
||||
}
|
||||
if (![_contacts containsObject:nsuri]) {
|
||||
[_contacts insertObject:nsuri atIndex:0];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,7 +126,8 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
|
|||
|
||||
- (void)addCurrentContactContactField:(NSString *)address {
|
||||
LinphoneAddress *linphoneAddress = linphone_core_interpret_url([LinphoneManager getLc], address.UTF8String);
|
||||
NSString *username = [NSString stringWithUTF8String:linphone_address_get_username(linphoneAddress)];
|
||||
NSString *username =
|
||||
linphoneAddress ? [NSString stringWithUTF8String:linphone_address_get_username(linphoneAddress)] : address;
|
||||
|
||||
if (([username rangeOfString:@"@"].length > 0) &&
|
||||
([[LinphoneManager instance] lpConfigBoolForKey:@"show_contacts_emails_preference"] == true)) {
|
||||
|
|
@ -137,8 +138,9 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
|
|||
} else {
|
||||
[_tableController addSipField:address];
|
||||
}
|
||||
linphone_address_destroy(linphoneAddress);
|
||||
|
||||
if (linphoneAddress) {
|
||||
linphone_address_destroy(linphoneAddress);
|
||||
}
|
||||
[self setEditing:FALSE];
|
||||
[[_tableController tableView] reloadData];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,9 +61,9 @@
|
|||
|
||||
- (IBAction)onCallClick:(id)event {
|
||||
LinphoneAddress *addr = linphone_core_interpret_url([LinphoneManager getLc], _addressLabel.text.UTF8String);
|
||||
char *lAddress = linphone_address_as_string_uri_only(addr);
|
||||
if (lAddress == NULL)
|
||||
if (addr == NULL)
|
||||
return;
|
||||
char *lAddress = linphone_address_as_string_uri_only(addr);
|
||||
NSString *displayName = [FastAddressBook displayNameForAddress:addr];
|
||||
|
||||
DialerView *view = VIEW(DialerView);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue