diff options
author | Matej Vasek <mvasek@redhat.com> | 2020-10-22 18:25:57 +0200 |
---|---|---|
committer | Matej Vasek <mvasek@redhat.com> | 2020-10-22 18:33:15 +0200 |
commit | 5098048f82118d3371ac4bdc2497cc5f22957914 (patch) | |
tree | 690c40a59941b2795bdba1c806d4caba23e0542d /pkg | |
parent | 89e7b8f22bec9b6f298eeca8ea7bbc9bc6b32c1d (diff) | |
download | podman-5098048f82118d3371ac4bdc2497cc5f22957914.tar.gz podman-5098048f82118d3371ac4bdc2497cc5f22957914.tar.bz2 podman-5098048f82118d3371ac4bdc2497cc5f22957914.zip |
src: add nil checks
Signed-off-by: Matej Vasek <mvasek@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/api/handlers/types.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/pkg/api/handlers/types.go b/pkg/api/handlers/types.go index 0851f48de..b0a177e65 100644 --- a/pkg/api/handlers/types.go +++ b/pkg/api/handlers/types.go @@ -273,10 +273,12 @@ func ImageDataToImageInspect(ctx context.Context, l *libpodImage.Image) (*ImageI } rootfs := docker.RootFS{} - rootfs.Type = info.RootFS.Type - rootfs.Layers = make([]string, 0, len(info.RootFS.Layers)) - for _, layer := range info.RootFS.Layers { - rootfs.Layers = append(rootfs.Layers, string(layer)) + if info.RootFS != nil && info.RootFS.Layers != nil { + rootfs.Type = info.RootFS.Type + rootfs.Layers = make([]string, 0, len(info.RootFS.Layers)) + for _, layer := range info.RootFS.Layers { + rootfs.Layers = append(rootfs.Layers, string(layer)) + } } dockerImageInspect := docker.ImageInspect{ Architecture: l.Architecture, |