summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaracenOne <SaracenOne@gmail.com>2022-07-27 23:37:42 +0100
committerSaracenOne <SaracenOne@gmail.com>2022-07-27 23:37:42 +0100
commit13075779328485b5ead6d9c5a317b894f193a9ae (patch)
tree39e2ff760912e2636e2a2b0b3f5e43c88be53f11
parent667cef39b4e9f98ed545d95de442319c447f2164 (diff)
Prevent hard crash in GDScriptVM when a named global can not be found.
-rw-r--r--modules/gdscript/gdscript_vm.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp
index e0beed367a..ce422dd30c 100644
--- a/modules/gdscript/gdscript_vm.cpp
+++ b/modules/gdscript/gdscript_vm.cpp
@@ -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];