Fix "getItemAtRow(...) is undefined" error for some item modifications

Since 67c63a29
This commit is contained in:
Dan Stillman 2014-12-01 16:48:11 -05:00
parent 01c80610b4
commit 0fd0da2903

View file

@ -569,11 +569,15 @@ Zotero.ItemTreeView.prototype.notify = function(action, type, ids, extraData)
if (action == 'delete' || action == 'trash' || if (action == 'delete' || action == 'trash' ||
!itemGroup.ref.hasItem(ids[i])) { !itemGroup.ref.hasItem(ids[i])) {
let row = this._itemRowMap[ids[i]]; let row = this._itemRowMap[ids[i]];
// Row might already be gone (e.g. if this is a child and // Row might already be gone (e.g. if this is a child and
// 'modify' was sent to parent) // 'modify' was sent to parent)
if (row != undefined) { if (row == undefined) {
rows.push(row); continue;
} }
rows.push(row);
// Remove child items of removed parents // Remove child items of removed parents
if (this.isContainer(row) && this.isContainerOpen(row)) { if (this.isContainer(row) && this.isContainerOpen(row)) {
while (++row < this.rowCount && this.getLevel(row) > 0) { while (++row < this.rowCount && this.getLevel(row) > 0) {