GDScript compiler: check if subclass exists before comparison
Otherwise these checks might trigger the insertion of an empty value, leading to crashes.
This commit is contained in:
parent
ced9fcafd4
commit
30f02dd421
1 changed files with 2 additions and 2 deletions
|
@ -486,7 +486,7 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
|
|||
script = codegen.script;
|
||||
} else {
|
||||
StringName name = cn->cast_type.class_type->name;
|
||||
if (class_map[name] == codegen.script->subclasses[name]) {
|
||||
if (codegen.script->subclasses.has(name) && class_map[name] == codegen.script->subclasses[name]) {
|
||||
idx = codegen.get_name_map_pos(name);
|
||||
idx |= GDScriptFunction::ADDR_TYPE_CLASS_CONSTANT << GDScriptFunction::ADDR_BITS;
|
||||
} else {
|
||||
|
@ -1183,7 +1183,7 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
|
|||
script = codegen.script;
|
||||
} else {
|
||||
StringName name = assign_type.class_type->name;
|
||||
if (class_map[name] == codegen.script->subclasses[name]) {
|
||||
if (codegen.script->subclasses.has(name) && class_map[name] == codegen.script->subclasses[name]) {
|
||||
idx = codegen.get_name_map_pos(name);
|
||||
idx |= GDScriptFunction::ADDR_TYPE_CLASS_CONSTANT << GDScriptFunction::ADDR_BITS;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue