Commit de7a4306 authored by Benjamin REIS's avatar Benjamin REIS

Do not crash if friend whith no LC but show an error

parent 717ea1ee
......@@ -108,13 +108,16 @@ static int friend_compare(const void * a, const void * b) {
}
static LinphoneFriendPresence * find_presence_model_for_uri_or_tel(const LinphoneFriend *lf, const char *uri_or_tel) {
bctbx_list_t *iterator = lf->presence_models;
LinphoneAddress *uri_or_tel_addr = linphone_core_interpret_url(lf->lc, uri_or_tel);
bctbx_list_t *iterator = NULL;
LinphoneAddress *uri_or_tel_addr = NULL;
LinphoneFriendPresence *result=NULL;
if (!lf->lc) {
ms_warning("Cannot find uri of tel [%s] from friend [%p] because not associated to any Linphone core object",uri_or_tel,lf);
return NULL;
}
iterator = lf->presence_models;
uri_or_tel_addr = linphone_core_interpret_url(lf->lc, uri_or_tel);
while (uri_or_tel_addr && iterator) {
LinphoneFriendPresence *lfp = (LinphoneFriendPresence *)bctbx_list_get_data(iterator);
LinphoneAddress *lfp_addr = linphone_core_interpret_url(lf->lc, lfp->uri_or_tel);
......
......@@ -706,6 +706,7 @@ LinphoneFriend * linphone_friend_list_find_friend_by_uri(const LinphoneFriendLis
LinphoneFriend * linphone_friend_list_find_friend_by_ref_key(const LinphoneFriendList *list, const char *ref_key) {
const bctbx_list_t *elem;
if (ref_key == NULL) return NULL;
if (list == NULL) return NULL;
for (elem = list->friends; elem != NULL; elem = bctbx_list_next(elem)) {
LinphoneFriend *lf = (LinphoneFriend *)bctbx_list_get_data(elem);
if ((lf->refkey != NULL) && (strcmp(lf->refkey, ref_key) == 0)) return lf;
......
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