From f2f18768a8c705a0a15abe814aaa52640af0b279 Mon Sep 17 00:00:00 2001
From: baude <bbaude@redhat.com>
Date: Mon, 15 Feb 2021 09:32:49 -0600
Subject: Fix panic in pod creation

when creating a pod with --infra-image and using a untagged image for
the infra-image (none/none), the lookup for the image's name was
creating a panic.

Fixes: #9374

Signed-off-by: baude <bbaude@redhat.com>
---
 libpod/runtime_pod_infra_linux.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'libpod')

diff --git a/libpod/runtime_pod_infra_linux.go b/libpod/runtime_pod_infra_linux.go
index bc37bdb23..c6f268182 100644
--- a/libpod/runtime_pod_infra_linux.go
+++ b/libpod/runtime_pod_infra_linux.go
@@ -225,7 +225,10 @@ func (r *Runtime) createInfraContainer(ctx context.Context, p *Pod) (*Container,
 	if err != nil {
 		return nil, err
 	}
-	imageName := newImage.Names()[0]
+	imageName := "none"
+	if len(newImage.Names()) > 0 {
+		imageName = newImage.Names()[0]
+	}
 	imageID := data.ID
 
 	return r.makeInfraContainer(ctx, p, imageName, r.config.Engine.InfraImage, imageID, data.Config)
-- 
cgit v1.2.3-54-g00ecf