diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2016-07-19 07:35:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-19 07:35:50 +0200 |
commit | 6626ac463eed0124736b8ef60bf82ba42a253200 (patch) | |
tree | 2271fb3c344b5498eeedb444d76bc1feaacb72ff /tools/editor/scene_tree_dock.cpp | |
parent | 13fe615ea34f3edcdbaa17820dd62d606a608b47 (diff) | |
parent | 2a97d79a64a9a1e96858221e62762b1b84d171eb (diff) |
Merge pull request #5783 from TheHX/issue-5782
Fix crash when dropping scene as a sibling of the root node
Diffstat (limited to 'tools/editor/scene_tree_dock.cpp')
-rw-r--r-- | tools/editor/scene_tree_dock.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index 2e7d65eadc..e4dfcc0f62 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -1574,14 +1574,12 @@ void SceneTreeDock::_normalize_drop(Node*& to_node, int &to_pos, int p_type) { to_pos=-1; - if (p_type==1 && to_node==EditorNode::get_singleton()->get_edited_scene()) { - //if at lower sibling of root node - to_pos=0; //just insert at begining of root node - } else if (p_type==-1) { + if (p_type==-1) { //drop at above selected node if (to_node==EditorNode::get_singleton()->get_edited_scene()) { to_node=NULL; - ERR_FAIL_COND(to_node==EditorNode::get_singleton()->get_edited_scene()); + ERR_EXPLAIN("Cannot perform drop above the root node!"); + ERR_FAIL(); } Node* upper_sibling=NULL; @@ -1617,8 +1615,9 @@ void SceneTreeDock::_normalize_drop(Node*& to_node, int &to_pos, int p_type) { } else if (p_type==1) { //drop at below selected node if (to_node==EditorNode::get_singleton()->get_edited_scene()) { - to_node=NULL; - ERR_FAIL_COND(to_node==EditorNode::get_singleton()->get_edited_scene()); + //if at lower sibling of root node + to_pos=0; //just insert at begining of root node + return; } |