summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-10-05 08:59:16 +0200
committerGitHub <noreply@github.com>2021-10-05 08:59:16 +0200
commite4e11e6a57123e548af4dd86f6cf54657e3e0845 (patch)
tree58393a90624beda4f62f77460dc24767457f7910
parent3479aaa36969adc6e889197624dba463f3d9795c (diff)
parent7725ebf3d2e7a988ce24aded5e081b0afac76fe5 (diff)
Merge pull request #53417 from vnen/gdscript-check-parser-ref-on-preload
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index ac031baa8c..c07849bfa8 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -3305,7 +3305,13 @@ GDScriptParser::DataType GDScriptAnalyzer::type_from_variant(const Variant &p_va
current = current->_owner;
}
- Ref<GDScriptParserRef> ref = get_parser_for(current->path);
+ Ref<GDScriptParserRef> ref = get_parser_for(current->get_path());
+ if (ref.is_null()) {
+ push_error("Could not find script in path.", p_source);
+ GDScriptParser::DataType error_type;
+ error_type.kind = GDScriptParser::DataType::VARIANT;
+ return error_type;
+ }
ref->raise_status(GDScriptParserRef::INTERFACE_SOLVED);
GDScriptParser::ClassNode *found = ref->get_parser()->head;