From 7e7b403043b55c2e1bb9227fce725ad87626ae97 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Tue, 11 Nov 2014 17:03:29 +0100 Subject: Construct a Null AllocatedPath if the filename conversion into UTF8 failed --- src/fs/AllocatedPath.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/fs/AllocatedPath.cxx') 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 -- cgit v1.2.3