From f7074a75b5592e5f7a9d06fd49cfc2b02c5f8508 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 24 Feb 2017 01:34:22 -0500 Subject: [PATCH] Fix error deleting selected library --- chrome/content/zotero/xpcom/collectionTreeView.js | 7 ++++++- test/tests/collectionTreeViewTest.js | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js index db1e90033..df186955f 100644 --- a/chrome/content/zotero/xpcom/collectionTreeView.js +++ b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -360,7 +360,12 @@ Zotero.CollectionTreeView.prototype.notify = Zotero.Promise.coroutine(function* // If there's not at least one new collection to be selected, get a scroll position to restore later var scrollPosition = false; if (action != 'add' || ids.every(id => extraData[id] && extraData[id].skipSelect)) { - scrollPosition = this._saveScrollPosition(); + if (action == 'delete' && (type == 'group' || type == 'feed')) { + // Don't try to access deleted library + } + else { + scrollPosition = this._saveScrollPosition(); + } } if (action == 'delete') { diff --git a/test/tests/collectionTreeViewTest.js b/test/tests/collectionTreeViewTest.js index e782146ea..a9c550fd6 100644 --- a/test/tests/collectionTreeViewTest.js +++ b/test/tests/collectionTreeViewTest.js @@ -409,6 +409,10 @@ describe("Zotero.CollectionTreeView", function() { // Group, collections, Duplicates, Unfiled, and trash assert.equal(cv.rowCount, originalRowCount + 9); + // Select group + yield cv.selectLibrary(group.libraryID); + yield waitForItemsLoad(win); + var spy = sinon.spy(cv, "refresh"); try { yield group.eraseTx();