Skip to content

Commit

Permalink
fix(web): check trigger.getType() for null before invoking equals met…
Browse files Browse the repository at this point in the history
…hod (#1277)

in PipelineController.getTriggeredPipelines to avoid a NullPointerException
  • Loading branch information
dbyron-sf committed Jun 30, 2023
1 parent 2a812ba commit 69141df
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ public Collection<Pipeline> getTriggeredPipelines(
trigger -> {
boolean retval =
trigger.getEnabled()
&& (trigger.getType().equals("pipeline"))
&& (trigger.getType() != null)
&& trigger.getType().equals("pipeline")
&& id.equals(trigger.getPipeline())
&& trigger.getStatus().contains(status);
log.debug(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,13 @@ abstract class PipelineControllerTck extends Specification {
[enabled: null, type: "pipeline", pipeline: "triggering-pipeline", status: [ "successful" ] ]
]
]))
pipelineDAO.create(null, new Pipeline([
name : "enabled trigger with null type",
application: "test",
triggers : [
[enabled: true, type: null, pipeline: "triggering-pipeline", status: [ "successful" ] ]
]
]))
when:
def response = mockMvc.perform(get("/pipelines/triggeredBy/triggering-pipeline/${status}/"))
Expand Down

0 comments on commit 69141df

Please sign in to comment.