From 14fc2a011ed77cffc68f8599285e5228e03d9f01 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 16 Jun 2022 10:47:11 +0200 Subject: [PATCH] - ZScript: don't allow multiple assignment syntax with only one element. --- src/common/scripting/backend/codegen.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/common/scripting/backend/codegen.cpp b/src/common/scripting/backend/codegen.cpp index 34f6d03b5f..9232a65898 100644 --- a/src/common/scripting/backend/codegen.cpp +++ b/src/common/scripting/backend/codegen.cpp @@ -2594,6 +2594,12 @@ FxExpression *FxMultiAssign::Resolve(FCompileContext &ctx) } auto VMRight = static_cast(Right); auto rets = VMRight->GetReturnTypes(); + if (Base.Size() == 1) + { + Right->ScriptPosition.Message(MSG_ERROR, "Multi-assignment with only one element", VMRight->Function->SymbolName.GetChars()); + delete this; + return nullptr; + } if (rets.Size() < Base.Size()) { Right->ScriptPosition.Message(MSG_ERROR, "Insufficient returns in function %s", VMRight->Function->SymbolName.GetChars());