From 41c689ac7722af715a04048d0c6e8ce39f08d2f5 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Tue, 22 Aug 2017 14:15:58 -0400 Subject: [PATCH] kpod-images: don't nil pointer on empty list Signed-off-by: Vincent Batts --- cmd/kpod/images.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/kpod/images.go b/cmd/kpod/images.go index 775ff679..a1194eb7 100644 --- a/cmd/kpod/images.go +++ b/cmd/kpod/images.go @@ -163,7 +163,11 @@ func outputImages(store storage.Store, images []storage.Image, truncate, digests case formats.JSONString: out = formats.JSONStructArray{Output: toGeneric(imageOutput)} default: - out = formats.StdoutTemplateArray{Output: toGeneric(imageOutput), Template: outputFormat, Fields: imageOutput[0].headerMap()} + if len(imageOutput) == 0 { + out = formats.StdoutTemplateArray{} + } else { + out = formats.StdoutTemplateArray{Output: toGeneric(imageOutput), Template: outputFormat, Fields: imageOutput[0].headerMap()} + } } formats.Writer(out).Out()