summaryrefslogtreecommitdiff
path: root/modules/gdscript/gd_compiler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdscript/gd_compiler.cpp')
-rw-r--r--modules/gdscript/gd_compiler.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp
index 7481eac620..d9bbe42979 100644
--- a/modules/gdscript/gd_compiler.cpp
+++ b/modules/gdscript/gd_compiler.cpp
@@ -1497,7 +1497,8 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa
String sub = p_class->extends_class[i];
if (script->subclasses.has(sub)) {
- script=script->subclasses[sub];
+ Ref<Script> subclass = script->subclasses[sub]; //avoid reference from dissapearing
+ script=subclass;
} else {
_set_error("Could not find subclass: "+sub,p_class);
@@ -1683,6 +1684,7 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa
if (err)
return err;
+
p_script->constants.insert(name,subclass); //once parsed, goes to the list of constants
p_script->subclasses.insert(name,subclass);