diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index 8580065255..a724a86687 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -1953,7 +1953,11 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa end: - if (context && context->fc) { + if (!context) { + return status; + } + + if (context->fc) { mod_avformat_destroy_output_context(context); }