From f468245caf6afdeb7fb7770c14936626d5a0efc8 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Thu, 18 Jan 2024 16:43:31 -0500 Subject: [PATCH] Attachments box: Don't set this._item to non-regular item Fixes occasional errors due to `getAttachments()` being called on a non-regular item in `updateCount()`. --- chrome/content/zotero/elements/attachmentsBox.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/elements/attachmentsBox.js b/chrome/content/zotero/elements/attachmentsBox.js index a0f7e0eab8..3ac01fbb6b 100644 --- a/chrome/content/zotero/elements/attachmentsBox.js +++ b/chrome/content/zotero/elements/attachmentsBox.js @@ -54,14 +54,11 @@ set item(item) { let isRegularItem = item?.isRegularItem(); this.hidden = !isRegularItem; - if (this._item === item) { + if (!isRegularItem || this._item === item) { return; } this._item = item; - if (!isRegularItem) { - return; - } this.refresh(); } @@ -184,6 +181,8 @@ } async refresh() { + if (!this._item) return; + this.usePreview = Zotero.Prefs.get('showAttachmentPreview'); await this._updateAttachmentIDs();