From cc60b005a1831810c1e7a693032ce95f88d42a39 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 13 Mar 2017 19:55:56 +0100 Subject: [PATCH] - fixed processing of parameter-less ZScript properties. --- src/scripting/zscript/zcc_compile.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index 7dc916be22..42abbf6e31 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -1830,14 +1830,23 @@ void ZCCCompiler::DispatchScriptProperty(PProperty *prop, ZCC_PropertyStmt *prop ZCC_ExprConstant one; unsigned parmcount = 1; ZCC_TreeNode *x = property->Values; - while (x->SiblingNext != property->Values) + if (x == nullptr) { - x = x->SiblingNext; - parmcount++; + parmcount = 0; + } + else + { + while (x->SiblingNext != property->Values) + { + x = x->SiblingNext; + parmcount++; + } } if (parmcount == 0 && prop->Variables.Size() == 1 && prop->Variables[0]->Type == TypeBool) { // allow boolean properties to have the parameter omitted + memset(&one, 0, sizeof(one)); + one.SourceName = property->SourceName; // This may not be null! one.Operation = PEX_ConstValue; one.NodeType = AST_ExprConstant; one.Type = TypeBool;