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,7 +1298,10 @@ func (i *Image) Comment(ctx context.Context, manifestType string) (string, error
if err != nil { if err != nil {
return "", err return "", err
} }
return ociv1Img.History[0].Comment, nil if len(ociv1Img.History) > 0 {
return ociv1Img.History[0].Comment, nil
}
return "", nil
} }
// Save writes a container image to the filesystem // Save writes a container image to the filesystem