aboutsummaryrefslogtreecommitdiffstats
path: root/src/Mapper.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-11-22 00:02:17 +0100
committerMax Kellermann <max@duempel.org>2013-11-22 00:02:17 +0100
commit67b8124a1d34c2fa850005317503663407b9648e (patch)
tree5d8233b2e2aad2b80a3b28d3d0345e38f5bdea06 /src/Mapper.cxx
parent51ec499c89ae62f366fbdfe08c87a05384905e2e (diff)
downloadmpd-67b8124a1d34c2fa850005317503663407b9648e.tar.gz
mpd-67b8124a1d34c2fa850005317503663407b9648e.tar.xz
mpd-67b8124a1d34c2fa850005317503663407b9648e.zip
Mapper: _get_music_directory_utf8() may return nullptr
If no music_directory is configured, return nullptr instead of an empty string. This fixes a crash when db_file is configured without music_directory.
Diffstat (limited to '')
-rw-r--r--src/Mapper.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Mapper.cxx b/src/Mapper.cxx
index 08597732a..cbe45daa0 100644
--- a/src/Mapper.cxx
+++ b/src/Mapper.cxx
@@ -133,7 +133,9 @@ void mapper_finish(void)
const char *
mapper_get_music_directory_utf8(void)
{
- return music_dir_utf8.c_str();
+ return music_dir_utf8.empty()
+ ? nullptr
+ : music_dir_utf8.c_str();
}
const AllocatedPath &