From b95e2debe274b9d6c79843398df6fe4e049f6554 Mon Sep 17 00:00:00 2001 From: Tim Scherhaufer Date: Fri, 22 Sep 2023 00:39:02 +0200 Subject: [PATCH] JS API: Fix spr colorkey default parameter In case that no parameter or undefined is passed to the spr function in JS, the parameter would evaluate to 0 due to a wrong default value in the code path when colorkey is not an array. In case of an array the default value would be -1, which is also specified in the wiki. We now pass -1 in case the parameter is not an array. See: #2291 --- src/api/js.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/js.c b/src/api/js.c index 275311dc9..1d2a29824 100644 --- a/src/api/js.c +++ b/src/api/js.c @@ -237,7 +237,7 @@ static JSValue js_spr(JSContext *ctx, JSValueConst this_val, s32 argc, JSValueCo } else { - colors[0] = getInteger2(ctx, argv[3], 0); + colors[0] = getInteger2(ctx, argv[3], -1); count = 1; }