summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-01-11 21:57:38 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2013-01-11 21:57:38 +0100
commitd42038cc4c65c1ab1a71b2c7d71f949d22d3346b (patch)
treeb4e09dba2e88ee0bd1452292956e98189e34a559
parentadab7fc5a061624ad931fee4f95de09f78ace91d (diff)
Fix move on node to self and node to non-existing.
-rw-r--r--src/taskmanager.cc6
1 files changed, 6 insertions, 0 deletions
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);