From d491aeb98ff0386515f804b5bbd28a4224fe86d5 Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Tue, 12 Feb 2019 17:56:27 -0800 Subject: [PATCH] Added NULL check on uncaught exceptions --- microscript/ILibDuktape_Helpers.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/microscript/ILibDuktape_Helpers.c b/microscript/ILibDuktape_Helpers.c index 81876a4..926f08b 100644 --- a/microscript/ILibDuktape_Helpers.c +++ b/microscript/ILibDuktape_Helpers.c @@ -450,6 +450,7 @@ duk_ret_t ILibDuktape_Process_UncaughtExceptionExGetter(duk_context *ctx) } void ILibDuktape_Process_UncaughtExceptionEx(duk_context *ctx, char *format, ...) { + if (ctx == NULL) { return; } char dest[4096]; int len = 0; va_list argptr; @@ -500,7 +501,7 @@ void ILibDuktape_Process_UncaughtExceptionEx(duk_context *ctx, char *format, ... // Error MUST be at top of stack when calling this method void ILibDuktape_Process_UncaughtException(duk_context *ctx) { - ILibDuktape_Process_UncaughtExceptionEx(ctx, ""); + if (ctx != NULL) { ILibDuktape_Process_UncaughtExceptionEx(ctx, ""); } } char* Duktape_GetContextGuidHex(duk_context *ctx) {