Fixed: the game could crash while parsing expressions in some places

This commit is contained in:
Leonard2 2016-08-04 19:45:24 +02:00 committed by Christoph Oelckers
parent 9229146eeb
commit 4a859393fe
2 changed files with 5 additions and 1 deletions

View file

@ -392,7 +392,7 @@ static FxExpression *ParseExpression0 (FScanner &sc, PClassActor *cls)
return ParseAtan2(sc, identifier, cls); return ParseAtan2(sc, identifier, cls);
default: default:
args = new FArgumentList; args = new FArgumentList;
func = dyn_cast<PFunction>(cls->Symbols.FindSymbol(identifier, true)); func = (cls == nullptr) ? nullptr : dyn_cast<PFunction>(cls->Symbols.FindSymbol(identifier, true));
try try
{ {
// There is an action function ACS_NamedExecuteWithResult which must be ignored here for this to work. // There is an action function ACS_NamedExecuteWithResult which must be ignored here for this to work.

View file

@ -4410,6 +4410,8 @@ ExpEmit FxClassTypeCast::Emit(VMFunctionBuilder *build)
FxExpression *FxStateByIndex::Resolve(FCompileContext &ctx) FxExpression *FxStateByIndex::Resolve(FCompileContext &ctx)
{ {
CHECKRESOLVED(); CHECKRESOLVED();
ABORT(ctx.Class);
if (ctx.Class->NumOwnedStates == 0) if (ctx.Class->NumOwnedStates == 0)
{ {
// This can't really happen // This can't really happen
@ -4464,6 +4466,8 @@ FxMultiNameState::FxMultiNameState(const char *_statestring, const FScriptPositi
FxExpression *FxMultiNameState::Resolve(FCompileContext &ctx) FxExpression *FxMultiNameState::Resolve(FCompileContext &ctx)
{ {
CHECKRESOLVED(); CHECKRESOLVED();
ABORT(ctx.Class);
if (names[0] == NAME_None) if (names[0] == NAME_None)
{ {
scope = NULL; scope = NULL;