From 88c467d684d3eecea393a69b63f05fa9258e3e57 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Thu, 19 Jan 2017 17:49:08 +0100 Subject: [PATCH] Fix crash when import friend with no ref key --- coreapi/friendlist.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/coreapi/friendlist.c b/coreapi/friendlist.c index 8906fc109..cb2ac2406 100644 --- a/coreapi/friendlist.c +++ b/coreapi/friendlist.c @@ -533,8 +533,10 @@ LinphoneFriendListStatus linphone_friend_list_import_friend(LinphoneFriendList * lf->friend_list = list; lf->lc = list->lc; list->friends = bctbx_list_append(list->friends, linphone_friend_ref(lf)); - bctbx_pair_t *pair = (bctbx_pair_t*) bctbx_pair_cchar_new(lf->refkey, linphone_friend_ref(lf)); - bctbx_map_cchar_insert_and_delete(list->friends_map, pair); + if (lf->refkey) { + bctbx_pair_t *pair = (bctbx_pair_t*) bctbx_pair_cchar_new(lf->refkey, linphone_friend_ref(lf)); + bctbx_map_cchar_insert_and_delete(list->friends_map, pair); + } if (synchronize) { list->dirty_friends_to_update = bctbx_list_append(list->dirty_friends_to_update, linphone_friend_ref(lf)); }