From 9ec26734d5096375ec4451a314ce364428d4449e Mon Sep 17 00:00:00 2001 From: MuDzYNN Date: Thu, 18 Jul 2024 16:38:59 +0200 Subject: [PATCH 1/2] Fix "Cannot read properties of null (reading 'focus')" in nui console --- ext/ui-build/data/root.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/ui-build/data/root.html b/ext/ui-build/data/root.html index 32549ae5ce..4f470e1092 100644 --- a/ext/ui-build/data/root.html +++ b/ext/ui-build/data/root.html @@ -105,7 +105,7 @@ frameEscapeFunctions[frameName] = () => { setTimeout(() => { if (document.activeElement == document.body) { - frame.contentWindow.focus(); + frame?.contentWindow?.focus(); } }, 32); } From 2dcb296b8cc02170bf11a04f827d27c269e9bdf8 Mon Sep 17 00:00:00 2001 From: MuDzYNN Date: Thu, 18 Jul 2024 16:51:49 +0200 Subject: [PATCH 2/2] Explain the changes --- ext/ui-build/data/root.html | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/ui-build/data/root.html b/ext/ui-build/data/root.html index 4f470e1092..9a4f700fe9 100644 --- a/ext/ui-build/data/root.html +++ b/ext/ui-build/data/root.html @@ -105,6 +105,7 @@ frameEscapeFunctions[frameName] = () => { setTimeout(() => { if (document.activeElement == document.body) { + // Added questions marks to avoid throwing error while something is null frame?.contentWindow?.focus(); } }, 32);