1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-13 13:31:48 +00:00

Avoid a crash in the gdscript analyser

This commit is contained in:
Gilles Roudière
2021-12-14 15:54:25 +01:00
parent 15aea89868
commit ab8119b5f6

View File

@@ -484,7 +484,7 @@ GDScriptParser::DataType GDScriptAnalyzer::resolve_datatype(GDScriptParser::Type
result = parser->head->get_datatype(); result = parser->head->get_datatype();
} else { } else {
Ref<GDScriptParserRef> ref = get_parser_for(ScriptServer::get_global_class_path(first)); Ref<GDScriptParserRef> ref = get_parser_for(ScriptServer::get_global_class_path(first));
if (ref->raise_status(GDScriptParserRef::INTERFACE_SOLVED) != OK) { if (!ref.is_valid() || ref->raise_status(GDScriptParserRef::INTERFACE_SOLVED) != OK) {
push_error(vformat(R"(Could not parse global class "%s" from "%s".)", first, ScriptServer::get_global_class_path(first)), p_type); push_error(vformat(R"(Could not parse global class "%s" from "%s".)", first, ScriptServer::get_global_class_path(first)), p_type);
return GDScriptParser::DataType(); return GDScriptParser::DataType();
} }
@@ -3956,8 +3956,10 @@ Ref<GDScriptParserRef> GDScriptAnalyzer::get_parser_for(const String &p_path) {
} else { } else {
Error err = OK; Error err = OK;
ref = GDScriptCache::get_parser(p_path, GDScriptParserRef::EMPTY, err, parser->script_path); ref = GDScriptCache::get_parser(p_path, GDScriptParserRef::EMPTY, err, parser->script_path);
if (ref.is_valid()) {
depended_parsers[p_path] = ref; depended_parsers[p_path] = ref;
} }
}
return ref; return ref;
} }