From 6409183e7294a268a5a6e6c5279181cefbe5b7e8 Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Sat, 2 Jul 2022 10:42:54 -0700 Subject: [PATCH] Fixed bug where ctx dereference was placed before the validity check, instead of after --- microscript/ILibDuktape_Polyfills.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/microscript/ILibDuktape_Polyfills.c b/microscript/ILibDuktape_Polyfills.c index 321b563..6eedc8e 100644 --- a/microscript/ILibDuktape_Polyfills.c +++ b/microscript/ILibDuktape_Polyfills.c @@ -1163,10 +1163,11 @@ void ILibDuktape_Polyfills_timer_elapsed(void *obj) { ILibDuktape_Timer *ptrs = (ILibDuktape_Timer*)obj; int argCount, i; - duk_context *ctx = ptrs->ctx; char *funcName; if (!ILibMemory_CanaryOK(ptrs)) { return; } + + duk_context *ctx = ptrs->ctx; if (duk_check_stack(ctx, 3) == 0) { return; } duk_push_heapptr(ctx, ptrs->callback); // [func]