From ff2aa9b105f9575b04d2e2effc57cb0f9180d599 Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Sun, 17 Mar 2024 06:55:09 +0000 Subject: [PATCH] JS: Fix `to_string()` with negative numbers --- applications/system/js_app/js_thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/system/js_app/js_thread.c b/applications/system/js_app/js_thread.c index fe0b833a07..ceaad5e36c 100644 --- a/applications/system/js_app/js_thread.c +++ b/applications/system/js_app/js_thread.c @@ -195,7 +195,7 @@ static void js_require(struct mjs* mjs) { } static void js_global_to_string(struct mjs* mjs) { - double num = mjs_get_int(mjs, mjs_arg(mjs, 0)); + double num = mjs_get_double(mjs, mjs_arg(mjs, 0)); char tmp_str[] = "-2147483648"; itoa(num, tmp_str, 10); mjs_val_t ret = mjs_mk_string(mjs, tmp_str, ~0, true);