diff options
author | wm4 <wm4@nowhere> | 2013-09-18 19:56:15 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-09-18 19:56:15 +0200 |
commit | 5249cccfcfb6c345a40dff2dee464d287fc69605 (patch) | |
tree | 7a0ba5538e6306365bde54ca9239156649026a18 /mpvcore/mplayer.c | |
parent | 1298dbdf013ef055fc2bb66fb3947441b7afc222 (diff) | |
download | mpv-5249cccfcfb6c345a40dff2dee464d287fc69605.tar.bz2 mpv-5249cccfcfb6c345a40dff2dee464d287fc69605.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 'mpvcore/mplayer.c')
-rw-r--r-- | mpvcore/mplayer.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/mpvcore/mplayer.c b/mpvcore/mplayer.c index 381f3385fd..d9715e447f 100644 --- a/mpvcore/mplayer.c +++ b/mpvcore/mplayer.c @@ -637,9 +637,11 @@ static void mk_config_dir(char *subdir) { void *tmp = talloc_new(NULL); char *confdir = talloc_steal(tmp, mp_find_user_config_file("")); - if (subdir) - confdir = mp_path_join(tmp, bstr0(confdir), bstr0(subdir)); - mkdir(confdir, 0777); + if (confdir) { + if (subdir) + confdir = mp_path_join(tmp, bstr0(confdir), bstr0(subdir)); + mkdir(confdir, 0777); + } talloc_free(tmp); } |