aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-11-11 17:03:29 +0100
committerMax Kellermann <max@duempel.org>2014-11-11 17:15:19 +0100
commit7e7b403043b55c2e1bb9227fce725ad87626ae97 (patch)
tree9ae6153c5ca0a38fe5b84d3c4a988566786e19fd
parentc64ad78c7bfa83585775617c692367e247966330 (diff)
downloadmpd-7e7b403043b55c2e1bb9227fce725ad87626ae97.tar.gz
mpd-7e7b403043b55c2e1bb9227fce725ad87626ae97.tar.xz
mpd-7e7b403043b55c2e1bb9227fce725ad87626ae97.zip
Construct a Null AllocatedPath if the filename conversion into UTF8 failed
-rw-r--r--NEWS1
-rw-r--r--src/fs/AllocatedPath.cxx6
2 files changed, 6 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index a9440b844..e1c499860 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
ver 0.18.18 (not yet released)
* decoder
- ffmpeg: support opus
+* fix crash on failed filename charset conversion
ver 0.18.17 (2014/11/02)
* playlist
diff --git a/src/fs/AllocatedPath.cxx b/src/fs/AllocatedPath.cxx
index 37b79a685..4651ea625 100644
--- a/src/fs/AllocatedPath.cxx
+++ b/src/fs/AllocatedPath.cxx
@@ -46,7 +46,11 @@ AllocatedPath::Build(const_pointer a, const_pointer b)
AllocatedPath
AllocatedPath::FromUTF8(const char *path_utf8)
{
- return AllocatedPath(Donate(), ::PathFromUTF8(path_utf8));
+ char *path = ::PathFromUTF8(path_utf8);
+ if (path == nullptr)
+ return AllocatedPath::Null();
+
+ return AllocatedPath(Donate(), path);
}
AllocatedPath