From 759ed34939640f3ed83dc8fa036fbbfc202f5180 Mon Sep 17 00:00:00 2001 From: MathMan05 Date: Fri, 15 Aug 2025 21:55:41 -0500 Subject: [PATCH] fix crash --- src/webpage/contextmenu.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/webpage/contextmenu.ts b/src/webpage/contextmenu.ts index 17d6dd8..f1aaeb3 100644 --- a/src/webpage/contextmenu.ts +++ b/src/webpage/contextmenu.ts @@ -147,10 +147,8 @@ class Contextmenu { static setup() { Contextmenu.declareMenu(); document.addEventListener("click", (event) => { - while (Contextmenu.currentmenu) { - if (!Contextmenu.currentmenu.contains(event.target as Node)) { - Contextmenu.declareMenu(); - } + while (Contextmenu.currentmenu && !Contextmenu.currentmenu.contains(event.target as Node)) { + Contextmenu.declareMenu(); } }); }