From ba2a2d2805547605b973f053c0f116816cf00d6e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 18 Dec 2008 20:33:21 +0000 Subject: [PATCH] prevent seg in sofia dialog refresh on null dialog git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10873 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/sofia_presence.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 8cd1fe0a5c..8253b8c66f 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1210,7 +1210,9 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * unsigned delta = (unsigned) (exptime * -1); switch_snprintf(sstr, sizeof(sstr), "active;expires=%u", delta); switch_snprintf(expires_str, sizeof(expires_str), "%u", delta); - nua_dialog_usage_set_refresh_range(nh->nh_ds->ds_usage, delta, delta); + if (nh && nh->nh_ds && nh->nh_ds->ds_usage) { + nua_dialog_usage_set_refresh_range(nh->nh_ds->ds_usage, delta, delta); + } } nua_notify(nh, @@ -1661,9 +1663,9 @@ void sofia_presence_handle_sip_i_subscribe(int status, } - - nua_dialog_usage_set_refresh_range(nh->nh_ds->ds_usage, exp_delta + SUB_OVERLAP, exp_delta + SUB_OVERLAP); - + if (nh && nh->nh_ds && nh->nh_ds->ds_usage) { + nua_dialog_usage_set_refresh_range(nh->nh_ds->ds_usage, exp_delta + SUB_OVERLAP, exp_delta + SUB_OVERLAP); + } nua_respond(nh, SIP_202_ACCEPTED, SIPTAG_CONTACT_STR(contact_str), NUTAG_WITH_THIS(nua), SIPTAG_SUBSCRIPTION_STATE_STR(sstr),