diff --git a/libavcodec/imgresample.c b/libavcodec/imgresample.c index ce1a05ce4b..adcfd04812 100644 --- a/libavcodec/imgresample.c +++ b/libavcodec/imgresample.c @@ -672,6 +672,8 @@ struct SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, void sws_freeContext(struct SwsContext *ctx) { + if (!ctx) + return; if ((ctx->resampling_ctx->iwidth != ctx->resampling_ctx->owidth) || (ctx->resampling_ctx->iheight != ctx->resampling_ctx->oheight)) { img_resample_close(ctx->resampling_ctx);