diff options
author | Paul Trojahn <paul.trojahn@gmail.com> | 2019-03-08 21:19:56 +0100 |
---|---|---|
committer | Paul Trojahn <paul.trojahn@gmail.com> | 2019-03-08 21:31:36 +0100 |
commit | 97e8c88ce7df2784561480da0ed5a16b78a95659 (patch) | |
tree | 8a15a7ccbb6d0d602db26e26d404906185008cdf /scene/main | |
parent | b69569415f6a3c7e8d15c6f58775260eba2bc09d (diff) |
Make get_node return NULL for empty NodePaths
Fixes #25292
Diffstat (limited to 'scene/main')
-rw-r--r-- | scene/main/node.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 04d7107fa4..d217701532 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -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 { + if (p_path.is_empty()) { + return NULL; + } + 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_FAIL_V(NULL); |