diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-21 21:18:51 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-21 21:18:51 +0100 |
commit | 88decd4391b2b459e6cc947b6dfaf073c6ec626f (patch) | |
tree | 27cfcff5858096fe36992b44c96037ae0f759c6c | |
parent | 3e94fb984bd6ceb741bdba651f46168f883479be (diff) | |
parent | 91b93465d51b0a2ea21c69cbaf2a9b991b8b248e (diff) |
Merge pull request #73679 from vnen/gdscript-autoload-ref-crash-fix
GDScript: Fix crash when autoload script can't be found
-rw-r--r-- | modules/gdscript/gdscript_analyzer.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 38f9163f70..e8666e1abd 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -657,6 +657,10 @@ GDScriptParser::DataType GDScriptAnalyzer::resolve_datatype(GDScriptParser::Type } else if (ProjectSettings::get_singleton()->has_autoload(first) && ProjectSettings::get_singleton()->get_autoload(first).is_singleton) { const ProjectSettings::AutoloadInfo &autoload = ProjectSettings::get_singleton()->get_autoload(first); Ref<GDScriptParserRef> ref = get_parser_for(autoload.path); + if (ref.is_null()) { + push_error(vformat(R"(The referenced autoload "%s" (from "%s") could not be loaded.)", first, autoload.path), p_type); + return bad_type; + } if (ref->raise_status(GDScriptParserRef::INHERITANCE_SOLVED) != OK) { push_error(vformat(R"(Could not parse singleton "%s" from "%s".)", first, autoload.path), p_type); return bad_type; |