Don't alloc string on null char* directory
This commit is contained in:
@@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user