From cd133dbcacdd762c3c0d2aff960af9a361821b66 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 22 Mar 2022 09:50:28 +0100 Subject: [PATCH] Change `OverlayManager.open` to always error if the overlay is already active The old code would allow an overlay to force close *itself*, before immediately re-opening itself, which actually isn't very helpful in practice since that won't re-run any overlay-specific initialization code. Given how the overlays are being used this really shouldn't have caused any issues, but it's a bug that we should fix nonetheless. --- web/overlay_manager.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/overlay_manager.js b/web/overlay_manager.js index 2dc7f75f0..b77f4a61a 100644 --- a/web/overlay_manager.js +++ b/web/overlay_manager.js @@ -80,10 +80,10 @@ class OverlayManager { if (!this.#overlays[name]) { throw new Error("The overlay does not exist."); } else if (this.#active) { - if (this.#overlays[name].canForceClose) { - this.#closeThroughCaller(); - } else if (this.#active === name) { + if (this.#active === name) { throw new Error("The overlay is already active."); + } else if (this.#overlays[name].canForceClose) { + this.#closeThroughCaller(); } else { throw new Error("Another overlay is currently active."); }