Merge pull request #3643 from openSUSE/history-panic

Fix possible runtime panic if image history len is zero
This commit is contained in:
OpenShift Merge Robot
2019-07-25 19:26:47 +02:00
committed by GitHub

View File

@ -1298,8 +1298,11 @@ func (i *Image) Comment(ctx context.Context, manifestType string) (string, error
if err != nil {
return "", err
}
if len(ociv1Img.History) > 0 {
return ociv1Img.History[0].Comment, nil
}
return "", nil
}
// Save writes a container image to the filesystem
func (i *Image) Save(ctx context.Context, source, format, output string, moreTags []string, quiet, compress bool) error {