From 66a6a7a4178deb7c850141399f6d8ef8f2909a9f Mon Sep 17 00:00:00 2001 From: matt1432 Date: Thu, 21 Mar 2024 17:47:06 -0400 Subject: [PATCH] fix(ags): don't try to close non-window layers --- modules/ags/config/services/pointers.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/ags/config/services/pointers.ts b/modules/ags/config/services/pointers.ts index c8c8ccb..64c3a80 100644 --- a/modules/ags/config/services/pointers.ts +++ b/modules/ags/config/services/pointers.ts @@ -188,8 +188,13 @@ class Pointers extends Service { getNoCloseWidgets(noCloseWidgetsNames); const widgets = overlayLayer.filter((n) => { - const window = - (App.getWindow(n.namespace) as PopupWindow); + let window = null as null | PopupWindow; + + if (App.windows.some((win) => + win.name === n.namespace)) { + window = (App + .getWindow(n.namespace) as PopupWindow); + } return window && window.close_on_unfocus && @@ -201,10 +206,10 @@ class Pointers extends Service { // Don't handle clicks when on certain widgets } else { - widgets?.forEach( + widgets.forEach( (w) => { if (!(pos.x > w.x && pos.x < w.x + w.w && - pos.y > w.y && pos.y < w.y + w.h)) { + pos.y > w.y && pos.y < w.y + w.h)) { App.closeWindow(w.namespace); } },