diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-07-25 19:26:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-25 19:26:47 +0200 |
commit | dff82d940e50c50c9f15a0371942662ccaaaae43 (patch) | |
tree | 760ce6951cc42b9141ece88bb7a88f682acda34c /libpod/image | |
parent | 5763618ce550d148e4541d8ab61874ea85d39ab0 (diff) | |
parent | 7630f1b52efbefec463223e7631bee2ca007ce14 (diff) | |
download | podman-dff82d940e50c50c9f15a0371942662ccaaaae43.tar.gz podman-dff82d940e50c50c9f15a0371942662ccaaaae43.tar.bz2 podman-dff82d940e50c50c9f15a0371942662ccaaaae43.zip |
Merge pull request #3643 from openSUSE/history-panic
Fix possible runtime panic if image history len is zero
Diffstat (limited to 'libpod/image')
-rw-r--r-- | libpod/image/image.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libpod/image/image.go b/libpod/image/image.go index db50e3dbd..068491f28 100644 --- a/libpod/image/image.go +++ b/libpod/image/image.go @@ -1298,7 +1298,10 @@ func (i *Image) Comment(ctx context.Context, manifestType string) (string, error if err != nil { 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 |