diff --git a/pkg/build/build.go b/pkg/build/build.go index 743322be0..7829397b1 100644 --- a/pkg/build/build.go +++ b/pkg/build/build.go @@ -737,10 +737,12 @@ func (b *Build) BuildPackage(ctx context.Context) error { return fmt.Errorf("failed to create ExternalRef for configfile: %w", err) } - // In SPDX v3 there is dedicate field for this - // https://spdx.github.io/spdx-spec/v3.0/model/Build/Properties/configSourceUri/ - log.Infof("adding external ref %s for ConfigFile", configFileRef) - externalRefs = append(externalRefs, *configFileRef) + if configFileRef != nil { + // In SPDX v3 there is dedicate field for this + // https://spdx.github.io/spdx-spec/v3.0/model/Build/Properties/configSourceUri/ + log.Infof("adding external ref %s for ConfigFile", configFileRef) + externalRefs = append(externalRefs, *configFileRef) + } if b.EmptyWorkspace { log.Infof("empty workspace requested")