diff options
author | Max Kellermann <max@duempel.org> | 2013-10-30 16:07:24 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-10-30 16:14:44 +0100 |
commit | a88c23b6e8a832ce4c20eac12731dc238da31d94 (patch) | |
tree | 3b1992669be35e713bddaceec21bd32f8c389827 /src | |
parent | 216e37bf3333ee2cd0ca364122b46e27ffd6caa4 (diff) | |
download | mpd-a88c23b6e8a832ce4c20eac12731dc238da31d94.tar.gz mpd-a88c23b6e8a832ce4c20eac12731dc238da31d94.tar.xz mpd-a88c23b6e8a832ce4c20eac12731dc238da31d94.zip |
Main: check the g_get_user_special_dir() result
Fixes crash.
Diffstat (limited to 'src')
-rw-r--r-- | src/Main.cxx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Main.cxx b/src/Main.cxx index ba1c83f6e..f27de84ec 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -135,10 +135,13 @@ glue_mapper_init(Error &error) return false; if (music_dir.IsNull()) { - music_dir = AllocatedPath::FromUTF8(g_get_user_special_dir(G_USER_DIRECTORY_MUSIC), - error); - if (music_dir.IsNull()) - return false; + const char *path = + g_get_user_special_dir(G_USER_DIRECTORY_MUSIC); + if (path != nullptr) { + music_dir = AllocatedPath::FromUTF8(path, error); + if (music_dir.IsNull()) + return false; + } } mapper_init(std::move(music_dir), std::move(playlist_dir)); |