player: fix crash when taking screenshots in idle mode

mpctx->filename is obviously not set if no file is playing.

When this code was written, it probably couldn't happen, because the
normal screenshot path fails much earlier in idle mode. But you can
still take screenshots in "full window" mode, and recently the
screenshot code was changed to use the "full window" mode if the normal
path does not work.
This commit is contained in:
wm4 2015-03-11 12:02:31 +01:00
parent 30860f7b10
commit ca474d22c9
1 changed files with 2 additions and 0 deletions

View File

@ -167,6 +167,8 @@ 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;