Commit befbdada authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

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

parent 0b6cc88d
...@@ -1133,6 +1133,11 @@ void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf) { ...@@ -1133,6 +1133,11 @@ void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf) {
return; 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) { 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"); 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); linphone_core_store_friends_list_in_db(lc, lf->friend_list);
......
...@@ -440,7 +440,7 @@ static void icon_press_handler(GtkEntry *entry){ ...@@ -440,7 +440,7 @@ static void icon_press_handler(GtkEntry *entry){
lf=linphone_core_get_friend_by_address(linphone_gtk_get_core(),uri); lf=linphone_core_get_friend_by_address(linphone_gtk_get_core(),uri);
ms_free(uri); ms_free(uri);
if (lf==NULL) if (lf==NULL)
lf=linphone_friend_new(); lf=linphone_core_create_friend(linphone_gtk_get_core());
if (lf!=NULL){ if (lf!=NULL){
linphone_friend_set_address(lf,addr); linphone_friend_set_address(lf,addr);
linphone_gtk_show_contact(lf, w); linphone_gtk_show_contact(lf, w);
...@@ -752,7 +752,7 @@ void linphone_gtk_contact_ok(GtkWidget *button){ ...@@ -752,7 +752,7 @@ void linphone_gtk_contact_ok(GtkWidget *button){
const gchar *name,*uri; const gchar *name,*uri;
LinphoneAddress* friend_address; LinphoneAddress* friend_address;
if (lf==NULL){ 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){ if (linphone_gtk_get_ui_config_int("use_subscribe_notify",1)==1){
show_presence=FALSE; show_presence=FALSE;
allow_presence=FALSE; allow_presence=FALSE;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment