From a88c23b6e8a832ce4c20eac12731dc238da31d94 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 30 Oct 2013 16:07:24 +0100 Subject: Main: check the g_get_user_special_dir() result Fixes crash. --- src/Main.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/Main.cxx') 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)); -- cgit v1.2.3