Fix potential crash when dragging collection to another library
Fixes #141, Error dragging collection containing standalone note to library where note isn't standalone
This commit is contained in:
parent
d102e32f7d
commit
2b0aaf6314
1 changed files with 12 additions and 0 deletions
|
@ -1667,6 +1667,18 @@ Zotero.CollectionTreeView.prototype.drop = function(row, orient, dataTransfer)
|
|||
if (!addItems[parent]) {
|
||||
addItems[parent] = [];
|
||||
}
|
||||
|
||||
// If source item is a top-level non-regular item (which can exist in a
|
||||
// collection) but target item is a child item (which can't), add target
|
||||
// item's parent to collection instead
|
||||
if (!item.isRegularItem()) {
|
||||
let targetItem = Zotero.Items.get(id);
|
||||
let targetItemParentID = targetItem.getSource();
|
||||
if (targetItemParentID) {
|
||||
id = targetItemParentID;
|
||||
}
|
||||
}
|
||||
|
||||
addItems[parent].push(id);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue