osbuild2: Don't add nil stages

Do nothing if a nil value is passed to pipeline.AddStage().

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
This commit is contained in:
Achilleas Koutsou 2021-08-06 01:41:16 +02:00 committed by Ondřej Budai
parent 67ae1acafd
commit 38e88daea6

View file

@ -30,6 +30,9 @@ func (p *Pipeline) SetBuild(build string) {
// AddStage appends a stage to the list of stages of a pipeline. The stages
// will be executed in the order they are appended.
// If the argument is nil, it is not added.
func (p *Pipeline) AddStage(stage *Stage) {
p.Stages = append(p.Stages, stage)
if stage != nil {
p.Stages = append(p.Stages, stage)
}
}