From 4872c627048586292135809a09cddf1b0338036f Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Wed, 18 Feb 2026 14:14:44 -0600 Subject: [PATCH] fix JS_ToNumber --- source/runtime.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/runtime.c b/source/runtime.c index f99557e8..b5c41bf1 100644 --- a/source/runtime.c +++ b/source/runtime.c @@ -3955,8 +3955,10 @@ JSValue JS_ToNumber (JSContext *ctx, JSValue val) { ret = val; break; case JS_TAG_BOOL: + ret = JS_NewInt32 (ctx, JS_ToBool (ctx, val)); + break; case JS_TAG_NULL: - ret = JS_NewInt32 (ctx, JS_VALUE_GET_INT (val)); + ret = JS_NewInt32 (ctx, 0); break; case JS_TAG_STRING_IMM: return JS_ThrowTypeError (ctx, "cannot convert text to a number");