From 21c55b56bfca1262c3f68918274f82abd37883f7 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Wed, 20 Sep 2023 07:45:33 +0200 Subject: [PATCH] Don't try to close the `altText` dialog if it's not open (PR 16977 follow-up) When closing a document in the viewer, e.g. by running `PDFViewerApplication.close()` in the console, the `AltTextManager.#finish` method currently throws *unless* the `altText` dialog is actually open. Similar to e.g. the PasswordPrompt, we should thus only attempt to close the `altText` dialog when it's open. --- web/alt_text_manager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/alt_text_manager.js b/web/alt_text_manager.js index 63a88a146..fc3b020ee 100644 --- a/web/alt_text_manager.js +++ b/web/alt_text_manager.js @@ -152,7 +152,7 @@ class AltTextManager { } #finish() { - if (this.#dialog) { + if (this.#overlayManager.active === this.#dialog) { this.#overlayManager.close(this.#dialog); } }