From 9b9773db165184359f04e3a882170328761e4b78 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 29 Mar 2018 07:40:31 -0400 Subject: [PATCH] Skip items in save session that no longer exist Ideally I guess the entry would be removed from the save popup in the connector and a second button click would do a fresh save rather than reopening the popup, but for now just avoid an error. Addresses zotero/zotero-connectors#220 --- chrome/content/zotero/xpcom/server_connector.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/chrome/content/zotero/xpcom/server_connector.js b/chrome/content/zotero/xpcom/server_connector.js index 4bd463c2a..df31ab423 100644 --- a/chrome/content/zotero/xpcom/server_connector.js +++ b/chrome/content/zotero/xpcom/server_connector.js @@ -200,6 +200,10 @@ Zotero.Server.Connector.SaveSession.prototype._updateObjects = async function (o // a child item (e.g., from Retrieve Metadata for PDF) if (objectType == 'item') { let item = object.isTopLevelItem() ? object : object.parentItem; + if (!Zotero.Items.exists(item.id)) { + Zotero.debug(`Item ${item.id} in save session no longer exists`); + continue; + } // Keep automatic tags let originalTags = item.getTags().filter(tag => tag.type == 1); item.setTags(originalTags.concat(tags));