1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2026-01-01 08:03:32 +00:00

Updated Duktape_GetBuffer(), so if the object is null or undefined, it returns NULL instead of throwing an exception

This commit is contained in:
Bryan Roe
2019-02-12 16:54:04 -08:00
parent a52a8e0c9f
commit bfce186759

View File

@@ -216,6 +216,10 @@ char* Duktape_GetBuffer(duk_context *ctx, duk_idx_t i, duk_size_t *bufLen)
duk_json_encode(ctx, i);
retVal = (char*)duk_get_lstring(ctx, i, bufLen);
}
else if (duk_is_null_or_undefined(ctx, i))
{
retVal = NULL;
}
else
{
ILibDuktape_Error(ctx, "Duktape_GetBuffer(): Unknown parameter");