Merge pull request #26803 from ptrojahn/emptynode
Make get_node return NULL for empty NodePaths
This commit is contained in:
commit
50ef456c78
1 changed files with 4 additions and 0 deletions
|
@ -1313,6 +1313,10 @@ Node *Node::_get_child_by_name(const StringName &p_name) const {
|
||||||
|
|
||||||
Node *Node::get_node_or_null(const NodePath &p_path) const {
|
Node *Node::get_node_or_null(const NodePath &p_path) const {
|
||||||
|
|
||||||
|
if (p_path.is_empty()) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!data.inside_tree && p_path.is_absolute()) {
|
if (!data.inside_tree && p_path.is_absolute()) {
|
||||||
ERR_EXPLAIN("Can't use get_node() with absolute paths from outside the active scene tree.");
|
ERR_EXPLAIN("Can't use get_node() with absolute paths from outside the active scene tree.");
|
||||||
ERR_FAIL_V(NULL);
|
ERR_FAIL_V(NULL);
|
||||||
|
|
Loading…
Reference in a new issue