From d42038cc4c65c1ab1a71b2c7d71f949d22d3346b Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 11 Jan 2013 21:57:38 +0100 Subject: Fix move on node to self and node to non-existing. --- src/taskmanager.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/taskmanager.cc b/src/taskmanager.cc index 7857d12..5f8e2d7 100644 --- a/src/taskmanager.cc +++ b/src/taskmanager.cc @@ -110,7 +110,13 @@ TaskIdListPair TaskManager::moveTask(taskid_t id, taskid_t to) if(isProtected(id)) return TaskIdListPair(); + if(id == to) throw std::exception(); // Node and new parent are the same node. + task_t t = tree.data(id); + + // Make sure the new parent exists. This will throw an exception if it doesn't + task_t t_ = tree.data(to); + t.parentid = to; TaskIdList tilremove = tree.remove(id); -- cgit v1.2.3