summaryrefslogtreecommitdiffstats
path: root/player/screenshot.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-03-11 12:02:31 +0100
committerwm4 <wm4@nowhere>2015-03-11 12:02:31 +0100
commitca474d22c98d678003cf5c94612d874d79eae442 (patch)
tree677a348d1171b36b62d2e3cbfa1805b3a9b46cf0 /player/screenshot.c
parent30860f7b1075d04b861e38cac72a6b1a2c951f6e (diff)
downloadmpv-ca474d22c98d678003cf5c94612d874d79eae442.tar.bz2
mpv-ca474d22c98d678003cf5c94612d874d79eae442.tar.xz
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.
Diffstat (limited to 'player/screenshot.c')
-rw-r--r--player/screenshot.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/player/screenshot.c b/player/screenshot.c
index 0f0ac72419..27ef468544 100644
--- a/player/screenshot.c
+++ b/player/screenshot.c
@@ -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;