Prevent hard crash in GDScriptVM when a named global can not be found.

This commit is contained in:
SaracenOne 2022-07-27 23:37:42 +01:00
parent 667cef39b4
commit 1307577932
1 changed files with 1 additions and 0 deletions

View File

@ -3280,6 +3280,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
int globalname_idx = _code_ptr[ip + 2];
GD_ERR_BREAK(globalname_idx < 0 || globalname_idx >= _global_names_count);
const StringName *globalname = &_global_names_ptr[globalname_idx];
GD_ERR_BREAK(!GDScriptLanguage::get_singleton()->get_named_globals_map().has(*globalname));
GET_INSTRUCTION_ARG(dst, 0);
*dst = GDScriptLanguage::get_singleton()->get_named_globals_map()[*globalname];