From 304bf53c28301a8dfd126f2304e02df5472e56b1 Mon Sep 17 00:00:00 2001 From: baude Date: Mon, 26 Mar 2018 18:28:20 -0500 Subject: cmd/podman/run.go: Error nicely when no image found When no image is found, display a useful error message. Also, in imageToRef protect against a nil image being passed. Resolves: #553 Signed-off-by: baude Closes: #555 Approved by: mheon --- libpod/image/image.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libpod/image') diff --git a/libpod/image/image.go b/libpod/image/image.go index b08fa1acd..22268ac45 100644 --- a/libpod/image/image.go +++ b/libpod/image/image.go @@ -465,6 +465,9 @@ func (i *Image) ToImageRef() (types.Image, error) { // toImageRef returns an Image Reference type from an image func (i *Image) toImageRef() (types.Image, error) { + if i == nil { + return nil, errors.Errorf("cannot convert nil image to image reference") + } if i.imgRef == nil { ref, err := is.Transport.ParseStoreReference(i.imageruntime.store, "@"+i.ID()) if err != nil { -- cgit v1.2.3-54-g00ecf