From 6609a5f340ae18f69cfb48d4caa61e03f2ab676d Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Wed, 18 Dec 2024 20:54:13 -0500 Subject: [PATCH] core: Length of undefined is 0. It's fine. Quiet some errors. --- src/util.js.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/util.js.c b/src/util.js.c index 699e0f53..e60168dd 100644 --- a/src/util.js.c +++ b/src/util.js.c @@ -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);