lib/icu/Converter: throw exception on error

This commit is contained in:
Max Kellermann
2016-04-13 10:39:29 +02:00
parent ac7ce73526
commit bec6fa4ad7
4 changed files with 23 additions and 20 deletions

View File

@@ -114,11 +114,12 @@ PathToUTF8(PathTraitsFS::const_pointer_type path_fs)
return FixSeparators(path_fs);
#ifdef HAVE_FS_CHARSET
const auto buffer = fs_converter->ToUTF8(path_fs);
if (buffer.IsNull())
try {
const auto buffer = fs_converter->ToUTF8(path_fs);
return FixSeparators(PathTraitsUTF8::string(buffer.c_str()));
} catch (const std::runtime_error &) {
return PathTraitsUTF8::string();
return FixSeparators(PathTraitsUTF8::string(buffer.c_str()));
}
#endif
#endif
}