fix crash when presence request is declined by an error sip message

This commit is contained in:
Jehan Monnier 2013-08-27 16:57:58 +02:00
parent 798bd06597
commit 50469413f0
2 changed files with 3 additions and 3 deletions

View file

@ -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));

View file

@ -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)){