From 332246314846ed07cace73e53733cc3a60b0e86c Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 14 Sep 2016 16:29:31 +0200 Subject: [PATCH] fix crash and bug around presence list subscription --- coreapi/friendlist.c | 3 ++- coreapi/proxy.c | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/coreapi/friendlist.c b/coreapi/friendlist.c index 6f53119a3..a76952fe9 100644 --- a/coreapi/friendlist.c +++ b/coreapi/friendlist.c @@ -976,11 +976,12 @@ void linphone_friend_list_export_friends_as_vcard4_file(LinphoneFriendList *list void linphone_friend_list_enable_subscriptions(LinphoneFriendList *list, bool_t enabled) { if (list->enable_subscriptions != enabled) { + list->enable_subscriptions = enabled; if (enabled) { linphone_friend_list_update_subscriptions(list, NULL, TRUE); } else { linphone_friend_list_close_subscriptions(list); } - list->enable_subscriptions = enabled; + } } diff --git a/coreapi/proxy.c b/coreapi/proxy.c index d04a6fdf8..fa27b38ed 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -633,12 +633,15 @@ char* linphone_proxy_config_normalize_phone_number(LinphoneProxyConfig *proxy, c LinphoneProxyConfig *tmpproxy = proxy ? proxy : linphone_proxy_config_new(); char* result = NULL; if (linphone_proxy_config_is_phone_number(tmpproxy, username)){ + LinphoneDialPlan dialplan = *linphone_dial_plan_by_ccc(tmpproxy->dial_prefix); //copy dial plan; char * flatten=flatten_number(username); - LinphoneDialPlan dialplan = *linphone_dial_plan_by_ccc(tmpproxy->dial_prefix); //copy dial plan ms_debug("Flattened number is '%s' for '%s'",flatten, username); - if (strcmp(tmpproxy->dial_prefix,dialplan.ccc)!=0){ - //probably generic dialplan, preserving proxy dial prefix - strcpy(dialplan.ccc,tmpproxy->dial_prefix); + + if (tmpproxy->dial_prefix){ + if (strcmp(tmpproxy->dial_prefix,dialplan.ccc) != 0){ + //probably generic dialplan, preserving proxy dial prefix + strcpy(dialplan.ccc,tmpproxy->dial_prefix); + } } /*if proxy has a dial prefix, modify phonenumber accordingly*/ if (tmpproxy->dial_prefix!=NULL && tmpproxy->dial_prefix[0]!='\0'){