Fixed Segfault when trying to store friend's vcard in db before it was added to a friendlist

This commit is contained in:
Sylvain Berfini 2016-02-25 16:30:55 +01:00
parent 0b6cc88dde
commit befbdada93
2 changed files with 7 additions and 2 deletions

View file

@ -1133,6 +1133,11 @@ void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf) {
return;
}
if (!lf || !lf->friend_list) {
ms_warning("Either the friend or the friend list is null, skipping...");
return;
}
if (lf->friend_list->storage_id == 0) {
ms_warning("Trying to add a friend in db, but friend list isn't, let's do that first");
linphone_core_store_friends_list_in_db(lc, lf->friend_list);

View file

@ -440,7 +440,7 @@ static void icon_press_handler(GtkEntry *entry){
lf=linphone_core_get_friend_by_address(linphone_gtk_get_core(),uri);
ms_free(uri);
if (lf==NULL)
lf=linphone_friend_new();
lf=linphone_core_create_friend(linphone_gtk_get_core());
if (lf!=NULL){
linphone_friend_set_address(lf,addr);
linphone_gtk_show_contact(lf, w);
@ -752,7 +752,7 @@ void linphone_gtk_contact_ok(GtkWidget *button){
const gchar *name,*uri;
LinphoneAddress* friend_address;
if (lf==NULL){
lf=linphone_friend_new();
lf=linphone_core_create_friend(linphone_gtk_get_core());
if (linphone_gtk_get_ui_config_int("use_subscribe_notify",1)==1){
show_presence=FALSE;
allow_presence=FALSE;