GDScript cache crashfix.

This commit is contained in:
K. S. Ernest (iFire) Lee 2021-11-01 00:35:05 -07:00 committed by Lyuma
parent e363f404a5
commit b69b526b7c
1 changed files with 4 additions and 1 deletions

View File

@ -122,6 +122,10 @@ Ref<GDScriptParserRef> GDScriptCache::get_parser(const String &p_path, GDScriptP
}
if (singleton->parser_map.has(p_path)) {
ref = Ref<GDScriptParserRef>(singleton->parser_map[p_path]);
if (ref.is_null()) {
r_error = ERR_INVALID_DATA;
return ref;
}
} else {
if (!FileAccess::exists(p_path)) {
r_error = ERR_FILE_NOT_FOUND;
@ -133,7 +137,6 @@ Ref<GDScriptParserRef> GDScriptCache::get_parser(const String &p_path, GDScriptP
ref->path = p_path;
singleton->parser_map[p_path] = ref.ptr();
}
r_error = ref->raise_status(p_status);
return ref;