summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-04-05 16:55:42 +0200
committerGitHub <noreply@github.com>2019-04-05 16:55:42 +0200
commit50ef456c7847d8119a4b9ecc7a1193ae4773da80 (patch)
treec18ff47ba6de49a9fad950976a90e37406b83d91
parente16fc72cef5769ddbb18375b9dd1ed40e82b646b (diff)
parent97e8c88ce7df2784561480da0ed5a16b78a95659 (diff)
Merge pull request #26803 from ptrojahn/emptynode
Make get_node return NULL for empty NodePaths
-rw-r--r--scene/main/node.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 96e286602a..128168ca72 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);