www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 2b0aaf63143dbfc4e237e1778d7e92f1d73170b6
parent d102e32f7d3728e0ce3bcf78029b4fedcdaedb4b
Author: Dan Stillman <dstillman@zotero.org>
Date:   Tue,  1 Mar 2016 01:18:52 -0500

Fix potential crash when dragging collection to another library

Fixes #141, Error dragging collection containing standalone note to library
where note isn't standalone

Diffstat:
Mchrome/content/zotero/xpcom/collectionTreeView.js | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -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); } }