Main: check the g_get_user_special_dir() result

Fixes crash.
This commit is contained in:
Max Kellermann 2013-10-30 16:07:24 +01:00
parent 216e37bf33
commit a88c23b6e8

View File

@ -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));