From 2cb33b0c334f0b389b8cbbf26a2a3f1af3bccd6d Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sun, 26 Apr 2020 15:35:36 +0100 Subject: [PATCH] dukky: Various checks for win being NULL Signed-off-by: Daniel Silverstone --- content/handlers/javascript/duktape/Console.bnd | 2 +- content/handlers/javascript/duktape/Window.bnd | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/content/handlers/javascript/duktape/Console.bnd b/content/handlers/javascript/duktape/Console.bnd index 3de875a81..fcf6ee83d 100644 --- a/content/handlers/javascript/duktape/Console.bnd +++ b/content/handlers/javascript/duktape/Console.bnd @@ -51,7 +51,7 @@ write_log_entry(duk_context *ctx, unsigned int group, browser_window_console_fla duk_size_t msglen; const char *msg = duk_safe_to_lstring(ctx, 0, &msglen); - if (priv_win == NULL || + if (priv_win == NULL || priv_win->win == NULL || browser_window_console_log(priv_win->win, BW_CS_SCRIPT_CONSOLE, msg, msglen, flags) != NSERROR_OK) { diff --git a/content/handlers/javascript/duktape/Window.bnd b/content/handlers/javascript/duktape/Window.bnd index 175f4acb9..2c26f1d70 100644 --- a/content/handlers/javascript/duktape/Window.bnd +++ b/content/handlers/javascript/duktape/Window.bnd @@ -277,6 +277,9 @@ static duk_ret_t dukky_window_closedown_thread(duk_context *ctx) init Window(struct browser_window *win, struct html_content *htmlc) %{ + /* It makes no sense if win or htmlc are NULL */ + assert(win != NULL); + assert(htmlc != NULL); /* element window */ priv->win = win; priv->htmlc = htmlc;