forked from cory/tildefriends
core: Length of undefined is 0. It's fine. Quiet some errors.
This commit is contained in:
parent
d9972cb349
commit
6609a5f340
@ -401,6 +401,11 @@ void tf_util_register(JSContext* context)
|
||||
|
||||
int tf_util_get_length(JSContext* context, JSValue value)
|
||||
{
|
||||
if (JS_IsUndefined(value))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
JSValue length = JS_GetPropertyStr(context, value, "length");
|
||||
int result = 0;
|
||||
JS_ToInt32(context, &result, length);
|
||||
|
Loading…
Reference in New Issue
Block a user