diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index f7668cdcee..295fa4aa57 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -1948,7 +1948,7 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa fmt = context->fc->oformat; - if ((tmp = switch_event_get_header(handle->params, "av_audio_codec"))) { + if (handle->params && (tmp = switch_event_get_header(handle->params, "av_audio_codec"))) { if ((context->audio_codec = avcodec_find_encoder_by_name(tmp))) { fmt->audio_codec = context->audio_codec->id; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "specified audio codec %s %s [%s]\n", @@ -1956,7 +1956,7 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa } } - if (!strcasecmp(ext, "wav") || switch_true(switch_event_get_header(handle->params, "av_record_audio_only"))) { + if (!strcasecmp(ext, "wav") || (handle->params && switch_true(switch_event_get_header(handle->params, "av_record_audio_only")))) { context->has_video = 0; switch_clear_flag(handle, SWITCH_FILE_FLAG_VIDEO); }