Skip to content

Commit

Permalink
fix(mpt): don't NPE on stages without a when (#1783)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpeach authored Nov 8, 2017
1 parent 52823d6 commit 631e144
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,14 @@ private void renderStage(StageDefinition stage, RenderContext context, String lo

stage.setName(renderStageProperty(stage.getName(), context, getStagePropertyLocation(locationNamespace, stage.getId(), "name")));
stage.setComments(renderStageProperty(stage.getComments(), context, getStagePropertyLocation(locationNamespace, stage.getId(), "comments")));
stage.setWhen(
stage.getWhen()
.stream()
.map(w -> renderStageProperty(w, context, getStagePropertyLocation(locationNamespace, stage.getId(), "when")))
.collect(Collectors.toList())
);
if (stage.getWhen() != null) {
stage.setWhen(
stage.getWhen()
.stream()
.map(w -> renderStageProperty(w, context, getStagePropertyLocation(locationNamespace, stage.getId(), "when")))
.collect(Collectors.toList())
);
}
}

private String renderStageProperty(String input, RenderContext context, String location) {
Expand Down

0 comments on commit 631e144

Please sign in to comment.