From 3ff731d0f723f1d1a4c6ba410c6ded4608612156 Mon Sep 17 00:00:00 2001 From: Martynas Bagdonas Date: Mon, 11 Dec 2023 00:09:05 +0200 Subject: [PATCH] Prevent UI crash when "Select All" is pressed from Zotero Edit menu Fixes zotero/zotero#3527 --- src/common/components/common/editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/components/common/editor.js b/src/common/components/common/editor.js index 60ed2af3..d6e1414d 100644 --- a/src/common/components/common/editor.js +++ b/src/common/components/common/editor.js @@ -238,7 +238,7 @@ function Toolbar({ onCommand }) { let range = selection.getRangeAt(0); let selectionRect = range.getBoundingClientRect(); let editorNode = range.startContainer.parentNode.closest('.editor'); - if (!editorNode.parentNode.contains(toolbarRef.current)) { + if (!editorNode || !editorNode.parentNode.contains(toolbarRef.current)) { toolbarRef.current.style.display = 'none'; activeRef.current = false; return;