Fixed crash if friend doesn't have a core yet while creating a vcard

This commit is contained in:
Sylvain Berfini 2017-01-18 10:21:50 +01:00
parent 86de4723da
commit 66715b35bc

View file

@ -1068,6 +1068,8 @@ void linphone_friend_set_vcard(LinphoneFriend *fr, LinphoneVcard *vcard) {
bool_t linphone_friend_create_vcard(LinphoneFriend *fr, const char *name) {
LinphoneVcard *vcard = NULL;
LinphoneCore *lc = NULL;
bool_t skip = FALSE;
if (!fr || !name) {
ms_error("Friend or name is null");
@ -1083,8 +1085,15 @@ bool_t linphone_friend_create_vcard(LinphoneFriend *fr, const char *name) {
}
vcard = linphone_vcard_new();
bool_t skip = 1 - lp_config_get_int(fr->lc->config, "misc", "store_friends", 1);
linphone_vcard_set_skip_validation(vcard, skip);
lc = fr->lc;
if (!lc && fr->friend_list) {
lc = fr->friend_list->lc;
}
if (lc) {
skip = 1 - lp_config_get_int(fr->lc->config, "misc", "store_friends", 1);
linphone_vcard_set_skip_validation(vcard, skip);
}
linphone_vcard_set_full_name(vcard, name);
linphone_friend_set_vcard(fr, vcard);
return TRUE;