From: Brian West Date: Tue, 2 Dec 2014 16:51:48 +0000 (-0600) Subject: FS-6980 #resolve don't crash when using native recording on recordstop the redo X-Git-Tag: v1.4.15^2~74^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a7b0227338e2b10cf71d5cb16c477000156c575;p=thirdparty%2Ffreeswitch.git FS-6980 #resolve don't crash when using native recording on recordstop the redo --- diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 4dad74c6f9..da988323f5 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1215,12 +1215,13 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s switch_file_remove(rh->file, switch_core_session_get_pool(session)); } - if (read_impl.actual_samples_per_second) { - switch_channel_set_variable_printf(channel, "record_seconds", "%d", rh->fh->samples_out / read_impl.actual_samples_per_second); - switch_channel_set_variable_printf(channel, "record_ms", "%d", rh->fh->samples_out / (read_impl.actual_samples_per_second / 1000)); + if (rh->fh) { + switch_channel_set_variable_printf(channel, "record_samples", "%d", rh->fh->samples_out); + if (read_impl.actual_samples_per_second) { + switch_channel_set_variable_printf(channel, "record_seconds", "%d", rh->fh->samples_out / read_impl.actual_samples_per_second); + switch_channel_set_variable_printf(channel, "record_ms", "%d", rh->fh->samples_out / (read_impl.actual_samples_per_second / 1000)); + } } - switch_channel_set_variable_printf(channel, "record_samples", "%d", rh->fh->samples_out); - } if (switch_event_create(&event, SWITCH_EVENT_RECORD_STOP) == SWITCH_STATUS_SUCCESS) {