From 1ebb84b58eb3531cd22a49a4d0ce497b9b356d90 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Mon, 24 Jun 2019 17:59:08 -0400 Subject: Handle images which contain no layers This fixes some of our handling of images which have no layers, i.e., those whose TopLayer is set to an empty value. Signed-off-by: Nalin Dahyabhai --- cmd/podman/tree.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cmd/podman/tree.go') diff --git a/cmd/podman/tree.go b/cmd/podman/tree.go index 6490c609d..0f62858e8 100644 --- a/cmd/podman/tree.go +++ b/cmd/podman/tree.go @@ -72,7 +72,11 @@ func printTree(imageInfo *image.InfoImage, layerInfoMap map[string]*image.LayerI fmt.Printf("Image ID: %s\n", imageInfo.ID[:12]) fmt.Printf("Tags:\t %s\n", imageInfo.Tags) fmt.Printf("Size:\t %v\n", units.HumanSizeWithPrecision(float64(*size), 4)) - fmt.Printf(fmt.Sprintf("Image Layers\n")) + if img.TopLayer() != "" { + fmt.Printf("Image Layers\n") + } else { + fmt.Printf("No Image Layers\n") + } if !whatRequires { // fill imageInfo with layers associated with image. -- cgit v1.2.3-54-g00ecf