Skip to content

Commit

Permalink
src: add nil checks
Browse files Browse the repository at this point in the history
Signed-off-by: Matej Vasek <[email protected]>
  • Loading branch information
matejvasek committed Oct 22, 2020
1 parent 89e7b8f commit 5098048
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/api/handlers/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 5098048

Please sign in to comment.