Skip to content

Commit a8e6de9

Browse files
kevmitchwm4
authored andcommitted
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".
1 parent eabc530 commit a8e6de9

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

player/screenshot.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,17 @@ static char *create_fname(struct MPContext *mpctx, char *template,
165165
}
166166
case 'f':
167167
case 'F': {
168-
if (!mpctx->filename)
169-
goto error_exit;
170-
char *video_file = mp_basename(mpctx->filename);
171-
if (video_file) {
172-
char *name = video_file;
173-
if (fmt == 'F')
174-
name = stripext(res, video_file);
175-
append_filename(&res, name);
176-
}
168+
char *video_file = NULL;
169+
if (mpctx->filename)
170+
video_file = mp_basename(mpctx->filename);
171+
172+
if (!video_file)
173+
video_file = "NO_FILE";
174+
175+
char *name = video_file;
176+
if (fmt == 'F')
177+
name = stripext(res, video_file);
178+
append_filename(&res, name);
177179
break;
178180
}
179181
case 'x':

0 commit comments

Comments
 (0)