From 1d5cf15d1dd5627f94ccb182b1f655a47f106e31 Mon Sep 17 00:00:00 2001 From: mrizzi Date: Thu, 26 Sep 2024 16:52:45 +0200 Subject: [PATCH] fix hasSBOM to manage the nil hasSBOMList Signed-off-by: mrizzi --- pkg/assembler/backends/ent/backend/sbom.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/assembler/backends/ent/backend/sbom.go b/pkg/assembler/backends/ent/backend/sbom.go index 8e00a577ab..362e25f493 100644 --- a/pkg/assembler/backends/ent/backend/sbom.go +++ b/pkg/assembler/backends/ent/backend/sbom.go @@ -311,8 +311,10 @@ func (b *EntBackend) HasSBOM(ctx context.Context, spec *model.HasSBOMSpec) ([]*m return nil, errors.Wrap(err, funcName) } var result []*model.HasSbom - for _, edge := range hasSBOMList.Edges { - result = append(result, edge.Node) + if hasSBOMList != nil { + for _, edge := range hasSBOMList.Edges { + result = append(result, edge.Node) + } } return result, nil }