Skip to content

Commit

Permalink
copy: fix nil pointer dereference when checking compression algorithm
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <[email protected]>
  • Loading branch information
crazy-max authored and mtrmac committed Sep 18, 2023
1 parent 83f3807 commit 635e0cd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions copy/single.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 635e0cd

Please sign in to comment.