aboutsummaryrefslogtreecommitdiff
path: root/tools/editor/scene_tree_editor.cpp
diff options
context:
space:
mode:
authorFranklin Sobrinho2016-07-18 15:00:14 -0300
committerFranklin Sobrinho2016-07-18 15:00:14 -0300
commit2a97d79a64a9a1e96858221e62762b1b84d171eb (patch)
tree41e519447b3a724a4f7b5f42e865b7a60e1eb8d0 /tools/editor/scene_tree_editor.cpp
parentc328693e837f5899b24504caef5a9ee5e4d4cb4e (diff)
downloadgodot-2a97d79a64a9a1e96858221e62762b1b84d171eb.tar.gz
godot-2a97d79a64a9a1e96858221e62762b1b84d171eb.tar.zst
godot-2a97d79a64a9a1e96858221e62762b1b84d171eb.zip
Fix crash when dropping scene as a sibling of the root node
Diffstat (limited to '')
-rw-r--r--tools/editor/scene_tree_editor.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp
index cc11cbc56..73358e805 100644
--- a/tools/editor/scene_tree_editor.cpp
+++ b/tools/editor/scene_tree_editor.cpp
@@ -983,6 +983,14 @@ bool SceneTreeEditor::can_drop_data_fw(const Point2& p_point,const Variant& p_da
if (!d.has("type"))
return false;
+ TreeItem *item = tree->get_item_at_pos(p_point);
+ if (!item)
+ return false;
+
+ int section = tree->get_drop_section_at_pos(p_point);
+ if (section<-1 || (section==-1 && !item->get_parent()))
+ return false;
+
if (String(d["type"])=="files") {
Vector<String> files = d["files"];
@@ -1005,15 +1013,7 @@ bool SceneTreeEditor::can_drop_data_fw(const Point2& p_point,const Variant& p_da
if (String(d["type"])=="nodes") {
- TreeItem *item = tree->get_item_at_pos(p_point);
- if (!item)
- return false;
- int section = tree->get_drop_section_at_pos(p_point);
- if (section<-1 || (section==-1 && !item->get_parent()))
- return false;
-
return true;
-
}
return false;