summaryrefslogtreecommitdiffstats
path: root/audio/filter/af_export.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-09-18 19:56:15 +0200
committerwm4 <wm4@nowhere>2013-09-20 21:21:23 +0200
commit939d34e8f1a474374eb1730b992ab84e2759b1fe (patch)
treeeac0697e98e767543e51ff8a7c8911114cdf1def /audio/filter/af_export.c
parentbb2238516b7f9709dd7ba650b1cdaf551a4fb78a (diff)
downloadmpv-939d34e8f1a474374eb1730b992ab84e2759b1fe.tar.bz2
mpv-939d34e8f1a474374eb1730b992ab84e2759b1fe.tar.xz
Config path functions can return NULL
It's quite unlikely, but functions like mp_find_user_config_file() can return NULL, e.g. if $HOME is unset. Fix all the code that didn't check for this correctly yet.
Diffstat (limited to 'audio/filter/af_export.c')
-rw-r--r--audio/filter/af_export.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/audio/filter/af_export.c b/audio/filter/af_export.c
index b4286c0e62..3a6f808a34 100644
--- a/audio/filter/af_export.c
+++ b/audio/filter/af_export.c
@@ -99,6 +99,12 @@ static int control(struct af_instance* af, int cmd, void* arg)
for(i = 1; i < af->data->nch; i++)
s->buf[i] = (uint8_t *)s->buf[0] + i*s->sz*af->data->bps;
+ if (!s->filename) {
+ mp_msg(MSGT_AFILTER, MSGL_FATAL, "[export] No filename set.\n",
+ s->filename);
+ return AF_ERROR;
+ }
+
// Init memory mapping
s->fd = open(s->filename, O_RDWR | O_CREAT | O_TRUNC, 0640);
mp_msg(MSGT_AFILTER, MSGL_INFO, "[export] Exporting to file: %s\n", s->filename);