From 50469413f014b67c8bc0c667070d7d0a5b8fd98d Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 27 Aug 2013 16:57:58 +0200 Subject: [PATCH] fix crash when presence request is declined by an error sip message --- coreapi/bellesip_sal/sal_op_presence.c | 4 ++-- coreapi/presence.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/coreapi/bellesip_sal/sal_op_presence.c b/coreapi/bellesip_sal/sal_op_presence.c index b88af986d..24ea3aefc 100644 --- a/coreapi/bellesip_sal/sal_op_presence.c +++ b/coreapi/bellesip_sal/sal_op_presence.c @@ -98,8 +98,8 @@ static void presence_response_event(void *op_base, const belle_sip_response_even belle_sip_header_expires_t* expires; if (sal_compute_sal_errors(response,&error,&sr,reason, sizeof(reason))) { - ms_error("subscription to [%s] rejected reason [%s]",sal_op_get_to(op),reason[0]!=0?reason:sal_reason_to_string(sr)); - op->base.root->callbacks.notify_presence(op,SalSubscribeTerminated, SalPresenceOffline,NULL); + ms_error("subscription to [%s] rejected reason [%s]",sal_op_get_to(op),reason[0]!=0?reason:sal_reason_to_string(sr)); + op->base.root->callbacks.notify_presence(op,SalSubscribeTerminated, NULL,NULL); /*NULL = offline*/ return; } set_or_update_dialog(op_base,belle_sip_response_event_get_dialog(event)); diff --git a/coreapi/presence.c b/coreapi/presence.c index 4b5f8425a..9f85d8af4 100644 --- a/coreapi/presence.c +++ b/coreapi/presence.c @@ -1587,7 +1587,7 @@ void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeStatus ss, Sa char *tmp; LinphoneFriend *lf; LinphoneAddress *friend=NULL; - LinphonePresenceModel *presence = (LinphonePresenceModel *)model; + LinphonePresenceModel *presence = model ? (LinphonePresenceModel *)model:linphone_presence_model_new_with_activity(LinphonePresenceActivityOffline, NULL); lf=linphone_find_friend_by_out_subscribe(lc->friends,op); if (lf==NULL && lp_config_get_int(lc->config,"sip","allow_out_of_subscribe_presence",0)){