core: Length of undefined is 0. It's fine. Quiet some errors.

This commit is contained in:
Cory McWilliams 2024-12-18 20:54:13 -05:00
parent d9972cb349
commit 6609a5f340

View File

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