From 7858412419b621b87c9df5cfd135a63d469dc498 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sun, 9 Feb 2020 21:25:20 +0100 Subject: [PATCH] Added check to make sure items are not dropped on the oprhaned folder --- nw/gui/elements/doctree.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nw/gui/elements/doctree.py b/nw/gui/elements/doctree.py index 28222af9..ae7aef17 100644 --- a/nw/gui/elements/doctree.py +++ b/nw/gui/elements/doctree.py @@ -613,16 +613,22 @@ class GuiDocTree(QTreeWidget): """ sHandle = self.getSelectedHandle() if sHandle is None: + logger.error("No handle selected") return - dIndex = self.indexAt(theEvent.pos()) + dIndex = self.indexAt(theEvent.pos()) if not dIndex.isValid(): + logger.error("Invalid drop index") return dItem = self.itemFromIndex(dIndex) dHandle = dItem.text(self.C_HANDLE) snItem = self.theProject.getItem(sHandle) dnItem = self.theProject.getItem(dHandle) + if dnItem is None: + self.makeAlert("The item cannot be moved to that location.", nwAlert.ERROR) + return + isSame = snItem.itemClass == dnItem.itemClass isNone = snItem.itemClass == nwItemClass.NO_CLASS isNote = snItem.itemLayout == nwItemLayout.NOTE