Skip to content

Commit

Permalink
Fix exception when generating a task without properties
Browse files Browse the repository at this point in the history
  • Loading branch information
arodus committed Aug 25, 2018
1 parent aa7ed62 commit c6e4855
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions source/Nuke.CodeGeneration/Generators/DataClassGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,18 @@ private static DataClassWriter WriteConfigureArguments(this DataClassWriter writ
return writer;

var argumentAdditions = formatProperties.Select(GetArgumentAddition).ToArray();
ref var last = ref argumentAdditions[argumentAdditions.Length - 1];
last += ";";

var hasArguments = argumentAdditions.Length > 0;
if (hasArguments)
{
argumentAdditions[argumentAdditions.Length - 1] += ";";
}

return writer
.WriteLine("protected override Arguments ConfigureArguments(Arguments arguments)")
.WriteBlock(w => w
.WriteLine("arguments")
.WriteLine(GetCommandAdditionOrNull(writer.DataClass))
.WriteLine($"{GetCommandAdditionOrNull(writer.DataClass)}{(hasArguments ? string.Empty : ";")}")
.ForEachWriteLine(argumentAdditions)
.WriteLine("return base.ConfigureArguments(arguments);"));
}
Expand Down

0 comments on commit c6e4855

Please sign in to comment.