From 13c6d169058ca5812d175be908e9181b09894c26 Mon Sep 17 00:00:00 2001 From: ZZYZX Date: Sat, 28 Jan 2017 01:12:42 +0200 Subject: [PATCH] Fixed: compile-time error in vararg function call would result in a crash. --- src/scripting/codegeneration/codegen.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/scripting/codegeneration/codegen.cpp b/src/scripting/codegeneration/codegen.cpp index d090fa6e4..8fd95c411 100644 --- a/src/scripting/codegeneration/codegen.cpp +++ b/src/scripting/codegeneration/codegen.cpp @@ -8202,14 +8202,16 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx) { // only cast implicit-string types for vararg, leave everything else as-is // this was outright copypasted from FxFormat - ArgList[i] = ArgList[i]->Resolve(ctx); - if (ArgList[i]->ValueType == TypeName || - ArgList[i]->ValueType == TypeSound) + x = ArgList[i]->Resolve(ctx); + if (x) { - x = new FxStringCast(ArgList[i]); - x = x->Resolve(ctx); + if (x->ValueType == TypeName || + x->ValueType == TypeSound) + { + x = new FxStringCast(ArgList[i]); + x = x->Resolve(ctx); + } } - else x = ArgList[i]; } else if (!(flag & (VARF_Ref|VARF_Out))) {