summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-01-17 06:58:00 +0100
committerGitHub <noreply@github.com>2020-01-17 06:58:00 +0100
commitba7aca4199019529dec60555a5ff005f6692d281 (patch)
treea5fe1b16b3b181dd09a2d37f423bd9763f245018
parent045a5ce14a22384b236e5a4fddeeb999e1c46f41 (diff)
parent9ffa9a6bac2fb80504af9b3ce450e3392150091f (diff)
Merge pull request #35224 from ChibiDenDen/constant_lookup_through_subclass_instance
Fix constant access in base class through subclass instance
-rw-r--r--modules/gdscript/gdscript_function.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp
index eef39da8b5..524be480d7 100644
--- a/modules/gdscript/gdscript_function.cpp
+++ b/modules/gdscript/gdscript_function.cpp
@@ -67,23 +67,23 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta
case ADDR_TYPE_CLASS_CONSTANT: {
//todo change to index!
- GDScript *o = p_script;
+ GDScript *s = p_script;
#ifdef DEBUG_ENABLED
ERR_FAIL_INDEX_V(address, _global_names_count, NULL);
#endif
const StringName *sn = &_global_names_ptr[address];
- while (o) {
- GDScript *s = o;
- while (s) {
+ while (s) {
+ GDScript *o = s;
+ while (o) {
- Map<StringName, Variant>::Element *E = s->constants.find(*sn);
+ Map<StringName, Variant>::Element *E = o->constants.find(*sn);
if (E) {
return &E->get();
}
- s = s->_base;
+ o = o->_owner;
}
- o = o->_owner;
+ s = s->_base;
}
ERR_FAIL_V_MSG(NULL, "GDScriptCompiler bug.");