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
commit dff82d940e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -1298,7 +1298,10 @@ 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