diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2015-10-23 01:00:40 +0300 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2015-10-23 13:38:30 +0300 |
commit | 0c7b44a01c1564ef681d51a5ed37d3908558143b (patch) | |
tree | f286931eb3a0d801f2d227568384506f1849b47b /libavfilter/vf_psnr.c | |
parent | a60539bb5e30d899c45c6ea9079f5b7669539f7a (diff) |
vf_psnr/ssim: don't crash if stats_file is NULL.
Diffstat (limited to 'libavfilter/vf_psnr.c')
-rw-r--r-- | libavfilter/vf_psnr.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c index ca419396ba..36bbab259f 100644 --- a/libavfilter/vf_psnr.c +++ b/libavfilter/vf_psnr.c @@ -193,17 +193,19 @@ static av_cold int init(AVFilterContext *ctx) s->min_mse = +INFINITY; s->max_mse = -INFINITY; - if (!strcmp(s->stats_file_str, "-")) { - s->stats_file = stdout; - } else if (s->stats_file_str) { - s->stats_file = fopen(s->stats_file_str, "w"); - if (!s->stats_file) { - int err = AVERROR(errno); - char buf[128]; - av_strerror(err, buf, sizeof(buf)); - av_log(ctx, AV_LOG_ERROR, "Could not open stats file %s: %s\n", - s->stats_file_str, buf); - return err; + if (s->stats_file_str) { + if (!strcmp(s->stats_file_str, "-")) { + s->stats_file = stdout; + } else { + s->stats_file = fopen(s->stats_file_str, "w"); + if (!s->stats_file) { + int err = AVERROR(errno); + char buf[128]; + av_strerror(err, buf, sizeof(buf)); + av_log(ctx, AV_LOG_ERROR, "Could not open stats file %s: %s\n", + s->stats_file_str, buf); + return err; + } } } |