Fixed possible nullptr dereferencing on c->Type() == nullptr

This commit is contained in:
ZZYZX 2017-02-16 02:14:49 +02:00
parent bd86abede3
commit 3577e4eddc

View file

@ -598,11 +598,11 @@ void ZCCCompiler::CreateClassTypes()
c->cls->Type = nullptr; c->cls->Type = nullptr;
} }
} }
if (c->Type() == nullptr) c->cls->Type = parent->FindClassTentative(c->NodeName());
if (c->cls->Flags & ZCC_Abstract) if (c->cls->Flags & ZCC_Abstract)
{ {
c->Type()->ObjectFlags |= OF_Abstract; c->Type()->ObjectFlags |= OF_Abstract;
} }
if (c->Type() == nullptr) c->cls->Type = parent->FindClassTentative(c->NodeName());
c->Type()->bExported = true; // this class is accessible to script side type casts. (The reason for this flag is that types like PInt need to be skipped.) c->Type()->bExported = true; // this class is accessible to script side type casts. (The reason for this flag is that types like PInt need to be skipped.)
c->cls->Symbol = new PSymbolType(c->NodeName(), c->Type()); c->cls->Symbol = new PSymbolType(c->NodeName(), c->Type());
OutNamespace->Symbols.AddSymbol(c->cls->Symbol); OutNamespace->Symbols.AddSymbol(c->cls->Symbol);