From 98a3b2e5f48444a95ac5382d18ae5ab1fe8683f7 Mon Sep 17 00:00:00 2001 From: miwanczuk Date: Sun, 11 Aug 2019 14:13:33 +0200 Subject: [PATCH] Fixes issue when inspecting nodes that are not in the tree --- core/script_debugger_remote.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index 5f01e043c46..6dd9054aaa6 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -601,9 +601,19 @@ void ScriptDebuggerRemote::_send_object_id(ObjectID p_id) { } } } + if (Node *node = Object::cast_to(obj)) { - PropertyInfo pi(Variant::NODE_PATH, String("Node/path")); - properties.push_front(PropertyDesc(pi, node->get_path())); + // in some cases node will not be in tree here + // for instance where it created as variable and not yet added to tree + // in such cases we can't ask for it's path + if (node->is_inside_tree()) { + PropertyInfo pi(Variant::NODE_PATH, String("Node/path")); + properties.push_front(PropertyDesc(pi, node->get_path())); + } else { + PropertyInfo pi(Variant::STRING, String("Node/path")); + properties.push_front(PropertyDesc(pi, "[Orphan]")); + } + } else if (Resource *res = Object::cast_to(obj)) { if (Script *s = Object::cast_to