Fix error deleting selected library

This commit is contained in:
Dan Stillman 2017-02-24 01:34:22 -05:00
parent 1633a73c3e
commit f7074a75b5
2 changed files with 10 additions and 1 deletions

View file

@ -360,8 +360,13 @@ 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 // If there's not at least one new collection to be selected, get a scroll position to restore later
var scrollPosition = false; var scrollPosition = false;
if (action != 'add' || ids.every(id => extraData[id] && extraData[id].skipSelect)) { if (action != 'add' || ids.every(id => extraData[id] && extraData[id].skipSelect)) {
if (action == 'delete' && (type == 'group' || type == 'feed')) {
// Don't try to access deleted library
}
else {
scrollPosition = this._saveScrollPosition(); scrollPosition = this._saveScrollPosition();
} }
}
if (action == 'delete') { if (action == 'delete') {
let selectedIndex = this.selection.count ? this.selection.currentIndex : 0; let selectedIndex = this.selection.count ? this.selection.currentIndex : 0;

View file

@ -409,6 +409,10 @@ describe("Zotero.CollectionTreeView", function() {
// Group, collections, Duplicates, Unfiled, and trash // Group, collections, Duplicates, Unfiled, and trash
assert.equal(cv.rowCount, originalRowCount + 9); assert.equal(cv.rowCount, originalRowCount + 9);
// Select group
yield cv.selectLibrary(group.libraryID);
yield waitForItemsLoad(win);
var spy = sinon.spy(cv, "refresh"); var spy = sinon.spy(cv, "refresh");
try { try {
yield group.eraseTx(); yield group.eraseTx();