Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Work around crash when creating new scenes

HolonProductionc6d29044a89a
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 1335477a0b1..b7bd6982a32 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -2743,6 +2743,7 @@ StringName Node::get_property_store_alias(const StringName &p_property) const {
bool Node::is_part_of_edited_scene() const {
return Engine::get_singleton()->is_editor_hint() && is_inside_tree() && data.tree->get_edited_scene_root() &&
+ data.tree->get_edited_scene_root()->get_parent() && // Defend against edge cases when creating new scenes and they are not fully added to the tree yet.
data.tree->get_edited_scene_root()->get_parent()->is_ancestor_of(this);
}
#endif