Merge pull request #63037 from cdemirer/fix-non-global-autoload-code-completion-crash

This commit is contained in:
Rémi Verschelde 2022-07-18 16:13:29 +02:00 committed by GitHub
commit d2df09d02b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2004,8 +2004,8 @@ static bool _guess_identifier_type(GDScriptParser::CompletionContext &p_context,
return false; return false;
} }
// Check autoloads. // Check global variables (including autoloads).
if (ProjectSettings::get_singleton()->has_autoload(p_identifier)) { if (GDScriptLanguage::get_singleton()->get_named_globals_map().has(p_identifier)) {
r_type = _type_from_variant(GDScriptLanguage::get_singleton()->get_named_globals_map()[p_identifier]); r_type = _type_from_variant(GDScriptLanguage::get_singleton()->get_named_globals_map()[p_identifier]);
return true; return true;
} }