Rework Node::get_node to omit is_absolute() check in best case scenario
This commit is contained in:
parent
f8b8d0d4b8
commit
e2792cc71c
1 changed files with 8 additions and 6 deletions
|
@ -1316,12 +1316,14 @@ Node *Node::get_node_or_null(const NodePath &p_path) const {
|
||||||
Node *Node::get_node(const NodePath &p_path) const {
|
Node *Node::get_node(const NodePath &p_path) const {
|
||||||
Node *node = get_node_or_null(p_path);
|
Node *node = get_node_or_null(p_path);
|
||||||
|
|
||||||
if (p_path.is_absolute()) {
|
if (unlikely(!node)) {
|
||||||
ERR_FAIL_COND_V_MSG(!node, nullptr,
|
if (p_path.is_absolute()) {
|
||||||
vformat(R"(Node not found: "%s" (absolute path attempted from "%s").)", p_path, get_path()));
|
ERR_FAIL_V_MSG(nullptr,
|
||||||
} else {
|
vformat(R"(Node not found: "%s" (absolute path attempted from "%s").)", p_path, get_path()));
|
||||||
ERR_FAIL_COND_V_MSG(!node, nullptr,
|
} else {
|
||||||
vformat(R"(Node not found: "%s" (relative to "%s").)", p_path, get_path()));
|
ERR_FAIL_V_MSG(nullptr,
|
||||||
|
vformat(R"(Node not found: "%s" (relative to "%s").)", p_path, get_path()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
|
Loading…
Reference in a new issue