From: Dragos Oancea Date: Mon, 25 Mar 2019 19:22:23 +0000 (+0000) Subject: FS-11951: JB: rare crash in reading the chan var (it maybe called without a session... X-Git-Tag: v1.10.0~55^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54c589500925106ed05de3331d195a0a3cafa366;p=thirdparty%2Ffreeswitch.git FS-11951: JB: rare crash in reading the chan var (it maybe called without a session in some unit tests) --- diff --git a/src/switch_jitterbuffer.c b/src/switch_jitterbuffer.c index f27b5ee8e1..8eabe61aba 100644 --- a/src/switch_jitterbuffer.c +++ b/src/switch_jitterbuffer.c @@ -880,18 +880,17 @@ SWITCH_DECLARE(void) switch_jb_set_session(switch_jb_t *jb, switch_core_session_ { const char *var; - jb->session = session; - jb->channel = switch_core_session_get_channel(session); - - if (jb->type == SJB_VIDEO && !switch_test_flag(jb, SJB_QUEUE_ONLY) && - (var = switch_channel_get_variable_dup(jb->channel, "jb_video_low_bitrate", SWITCH_FALSE, -1))) { - int tmp = atoi(var); - - if (tmp >= 128 && tmp <= 10240) { - jb->video_low_bitrate = (uint32_t)tmp; + if (session) { + jb->session = session; + jb->channel = switch_core_session_get_channel(session); + if (jb->type == SJB_VIDEO && !switch_test_flag(jb, SJB_QUEUE_ONLY) && + (var = switch_channel_get_variable_dup(jb->channel, "jb_video_low_bitrate", SWITCH_FALSE, -1))) { + int tmp = atoi(var); + if (tmp >= 128 && tmp <= 10240) { + jb->video_low_bitrate = (uint32_t)tmp; + } } } - } SWITCH_DECLARE(void) switch_jb_set_flag(switch_jb_t *jb, switch_jb_flag_t flag)