From b414378636440ae06142ca2b3bdec4798210db85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Lemi=C3=A8re?= Date: Sun, 29 Mar 2015 09:57:02 +0200 Subject: [PATCH] Don't alloc string on null char* directory --- project/src/ExternalInterface.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/project/src/ExternalInterface.cpp b/project/src/ExternalInterface.cpp index 054a67c21..8d6330690 100644 --- a/project/src/ExternalInterface.cpp +++ b/project/src/ExternalInterface.cpp @@ -592,7 +592,17 @@ namespace lime { if (!val_is_null (company)) companyName = val_string (company); if (!val_is_null (title)) titleName = val_string (title); - return alloc_string (System::GetDirectory ((SystemDirectory)val_int (type), companyName, titleName)); + const char* r = System::GetDirectory ((SystemDirectory)val_int (type), companyName, titleName); + + if (r) { + + return alloc_string(r); + + } else { + + return alloc_null(); + + } } @@ -873,4 +883,4 @@ extern "C" int lime_register_prims () { return 0; -} \ No newline at end of file +}