diff --git a/coreapi/friend.c b/coreapi/friend.c index 5319d3c41..5e448c66f 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -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); diff --git a/gtk/friendlist.c b/gtk/friendlist.c index 3d51e0459..5a7c29c46 100644 --- a/gtk/friendlist.c +++ b/gtk/friendlist.c @@ -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;