From 7d4bdcf80ad34ce78a0dbc837e05f084e2a42270 Mon Sep 17 00:00:00 2001 From: jsjtxietian Date: Tue, 9 Apr 2024 12:37:32 +0800 Subject: [PATCH] Fix `_node_assign` will crash when base_node is nullptr --- editor/editor_properties.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 4858fcf78fc..ea364d8a0d0 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -2755,7 +2755,8 @@ void EditorPropertyNodePath::_node_assign() { Variant val = get_edited_property_value(); Node *n = nullptr; if (val.get_type() == Variant::Type::NODE_PATH) { - n = get_base_node()->get_node_or_null(val); + Node *base_node = get_base_node(); + n = base_node == nullptr ? nullptr : base_node->get_node_or_null(val); } else { n = Object::cast_to(val); }