Fix _node_assign will crash when base_node is nullptr

This commit is contained in:
jsjtxietian 2024-04-09 12:37:32 +08:00
parent 9d6bdbc56e
commit 7d4bdcf80a

View file

@ -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<Node>(val);
}