commit f7074a75b5592e5f7a9d06fd49cfc2b02c5f8508
parent 1633a73c3ed8b09575f78a895bd1e708dc082c5b
Author: Dan Stillman <dstillman@zotero.org>
Date: Fri, 24 Feb 2017 01:34:22 -0500
Fix error deleting selected library
Diffstat:
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git 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
@@ -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();