From 38e88daea63da1fbf1d6878149554c07909c830e Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Fri, 6 Aug 2021 01:41:16 +0200 Subject: [PATCH] osbuild2: Don't add nil stages Do nothing if a nil value is passed to pipeline.AddStage(). Signed-off-by: Achilleas Koutsou --- internal/osbuild2/osbuild.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/osbuild2/osbuild.go b/internal/osbuild2/osbuild.go index fab0d3103..3653c5925 100644 --- a/internal/osbuild2/osbuild.go +++ b/internal/osbuild2/osbuild.go @@ -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) + } }