Don't alloc string on null char* directory

This commit is contained in:
Valentin Lemière
2015-03-29 09:57:02 +02:00
parent d2a0cc77ff
commit b414378636

View File

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