[njs] QuickJS: fixed SharedDict.incr() with empty init argument.
noreply at nginx.com
noreply at nginx.com
Thu Feb 20 18:18:02 UTC 2025
details: https://github.com/nginx/njs/commit/13f0787fc52e36ae5ed67add0a14c412b3c7b716
branches: master
commit: 13f0787fc52e36ae5ed67add0a14c412b3c7b716
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Wed, 19 Feb 2025 16:50:15 -0800
description:
QuickJS: fixed SharedDict.incr() with empty init argument.
---
nginx/ngx_js_shared_dict.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/nginx/ngx_js_shared_dict.c b/nginx/ngx_js_shared_dict.c
index e317211e..06f940e0 100644
--- a/nginx/ngx_js_shared_dict.c
+++ b/nginx/ngx_js_shared_dict.c
@@ -2219,7 +2219,10 @@ ngx_qjs_ext_shared_dict_incr(JSContext *cx, JSValueConst this_val,
return JS_EXCEPTION;
}
- if (JS_ToFloat64(cx, &init, argv[2]) < 0) {
+ if (JS_IsUndefined(argv[2])) {
+ init = 0;
+
+ } else if (JS_ToFloat64(cx, &init, argv[2]) < 0) {
return JS_EXCEPTION;
}
More information about the nginx-devel
mailing list