Construct a Null AllocatedPath if the filename conversion into UTF8 failed

This commit is contained in:
Florent Le Coz 2014-11-11 17:03:29 +01:00 committed by Max Kellermann
parent c64ad78c7b
commit 7e7b403043
2 changed files with 6 additions and 1 deletions

1
NEWS
View File

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

View File

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