summaryrefslogtreecommitdiff
path: root/libpod/image/image.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-03-26 18:28:20 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-03-27 00:17:55 +0000
commit304bf53c28301a8dfd126f2304e02df5472e56b1 (patch)
tree37a3232f99f7c67f35f38cd0e6d85840040746b3 /libpod/image/image.go
parenta3156da21ccd830639ff5699c13da82f3062439b (diff)
downloadpodman-304bf53c28301a8dfd126f2304e02df5472e56b1.tar.gz
podman-304bf53c28301a8dfd126f2304e02df5472e56b1.tar.bz2
podman-304bf53c28301a8dfd126f2304e02df5472e56b1.zip
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 <bbaude@redhat.com> Closes: #555 Approved by: mheon
Diffstat (limited to 'libpod/image/image.go')
-rw-r--r--libpod/image/image.go3
1 files changed, 3 insertions, 0 deletions
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 {