From 3577e4eddcaf4708734b9e857a5580a0e72aa157 Mon Sep 17 00:00:00 2001 From: ZZYZX Date: Thu, 16 Feb 2017 02:14:49 +0200 Subject: [PATCH] Fixed possible nullptr dereferencing on c->Type() == nullptr --- src/scripting/zscript/zcc_compile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index a240c1973..bd73fa06c 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -598,11 +598,11 @@ void ZCCCompiler::CreateClassTypes() c->cls->Type = nullptr; } } + if (c->Type() == nullptr) c->cls->Type = parent->FindClassTentative(c->NodeName()); if (c->cls->Flags & ZCC_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->cls->Symbol = new PSymbolType(c->NodeName(), c->Type()); OutNamespace->Symbols.AddSymbol(c->cls->Symbol);