From 635e0cdb588bb5b9398c2d11e6f61a90c38ca742 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 15 Sep 2023 20:43:51 +0200 Subject: [PATCH] copy: fix nil pointer dereference when checking compression algorithm Signed-off-by: CrazyMax --- copy/single.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/copy/single.go b/copy/single.go index 02651bd4c..918e756c2 100644 --- a/copy/single.go +++ b/copy/single.go @@ -380,8 +380,9 @@ func (ic *imageCopier) compareImageDestinationManifestEqual(ctx context.Context, compressionAlgos := set.New[string]() for _, srcInfo := range ic.src.LayerInfos() { - compression := compressionAlgorithmFromMIMEType(srcInfo) - compressionAlgos.Add(compression.Name()) + if c := compressionAlgorithmFromMIMEType(srcInfo); c != nil { + compressionAlgos.Add(c.Name()) + } } algos, err := algorithmsByNames(compressionAlgos.Values())