summaryrefslogtreecommitdiffstats
path: root/player/screenshot.c
diff options
context:
space:
mode:
authorKevin Mitchell <kevmitch@gmail.com>2015-09-01 19:41:16 -0700
committerwm4 <wm4@nowhere>2015-09-02 10:34:36 +0200
commita8e6de90fee1699c5de89eb1ae2182ceb096a65b (patch)
treedf800a7e12d54428ebc393c371dec4f550c0ab28 /player/screenshot.c
parenteabc5309457d8b3926c8d81c55f4de303a76b227 (diff)
downloadmpv-a8e6de90fee1699c5de89eb1ae2182ceb096a65b.tar.bz2
mpv-a8e6de90fee1699c5de89eb1ae2182ceb096a65b.tar.xz
screenshot: avoid confusing template error message with no file
Previously, with mpv --force-window=yes --idle=yes --screenshot-template="%f", mpv would display an error saying that the template was incorrect, which it isn't, there's just no file to put in the format. In this case, just use the string "NO_FILE".
Diffstat (limited to 'player/screenshot.c')
-rw-r--r--player/screenshot.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/player/screenshot.c b/player/screenshot.c
index f30ccf9581..9c4f5cc84e 100644
--- a/player/screenshot.c
+++ b/player/screenshot.c
@@ -165,15 +165,17 @@ static char *create_fname(struct MPContext *mpctx, char *template,
}
case 'f':
case 'F': {
- if (!mpctx->filename)
- goto error_exit;
- char *video_file = mp_basename(mpctx->filename);
- if (video_file) {
- char *name = video_file;
- if (fmt == 'F')
- name = stripext(res, video_file);
- append_filename(&res, name);
- }
+ char *video_file = NULL;
+ if (mpctx->filename)
+ video_file = mp_basename(mpctx->filename);
+
+ if (!video_file)
+ video_file = "NO_FILE";
+
+ char *name = video_file;
+ if (fmt == 'F')
+ name = stripext(res, video_file);
+ append_filename(&res, name);
break;
}
case 'x':