From 0cb052fcc63215d208b56003fafc33bc34fc3b09 Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Thu, 31 Jan 2019 14:38:51 -0800 Subject: [PATCH] Added additional check to verify if emitter was finalized --- microscript/ILibduktape_EventEmitter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/microscript/ILibduktape_EventEmitter.c b/microscript/ILibduktape_EventEmitter.c index 590a85c..e860bf4 100644 --- a/microscript/ILibduktape_EventEmitter.c +++ b/microscript/ILibduktape_EventEmitter.c @@ -191,7 +191,7 @@ duk_ret_t ILibDuktape_EventEmitter_emit(duk_context *ctx) self = duk_get_heapptr(ctx, -1); duk_pop(ctx); // ... - if (data->eventTable == NULL) { duk_push_false(ctx); return(1); } // This probably means the finalizer was already run on the eventEmitter + if (data->eventTable == NULL || data->ctx == NULL) { duk_push_false(ctx); return(1); } // This probably means the finalizer was already run on the eventEmitter eventList = ILibHashtable_Get(data->eventTable, NULL, name, (int)nameLen); if (eventList == NULL)