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

Fixed segfault when manipulating friends with vcards without carddav configured

parent 0676eaf4
......@@ -451,6 +451,7 @@ static LinphoneFriendListStatus _linphone_friend_list_remove_friend(LinphoneFrie
LinphoneVCard *lvc = linphone_friend_get_vcard(lf);
if (lvc && linphone_vcard_get_uid(lvc)) {
LinphoneCardDavContext *cdc = linphone_carddav_context_new(list);
if (cdc) {
cdc->sync_done_cb = carddav_done;
if (cdc->friend_list->cbs->sync_state_changed_cb) {
cdc->friend_list->cbs->sync_state_changed_cb(cdc->friend_list, LinphoneFriendListSyncStarted, NULL);
......@@ -458,6 +459,7 @@ static LinphoneFriendListStatus _linphone_friend_list_remove_friend(LinphoneFrie
linphone_carddav_delete_vcard(cdc, lf);
}
}
}
lf->friend_list = NULL;
linphone_friend_unref(lf);
......
......@@ -120,11 +120,7 @@ static void friends_migration(void) {
BC_ASSERT_EQUAL(ms_list_size(friends), 3, int, "%d");
friends_from_db = linphone_core_fetch_friends_from_db(manager->lc, lfl);
BC_ASSERT_EQUAL(ms_list_size(friends_from_db), 3, int, "%d");
if (ms_list_size(friends_from_db) < 3) {
goto end;
}
end:
friends_from_db = ms_list_free_with_data(friends_from_db, (void (*)(void *))linphone_friend_unref);
unlink(friends_db);
ms_free(friends_db);
......
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