From 97fcaeec7b5eb382d6d54164d91a0321bfa356c1 Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Fri, 28 Jun 2019 16:33:25 +0800 Subject: [PATCH] [FIX] slice bounds out of range --- grctl/cmd/service.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/grctl/cmd/service.go b/grctl/cmd/service.go index 944848966..76e64b086 100644 --- a/grctl/cmd/service.go +++ b/grctl/cmd/service.go @@ -35,8 +35,8 @@ import ( "github.com/gosuri/uitable" "github.com/tidwall/gjson" "github.com/urfave/cli" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" //conf "github.com/goodrain/rainbond/cmd/grctl/option" ) @@ -536,7 +536,9 @@ func getContainerIDAndState(status corev1.ContainerStatus) (cid, s string) { s = "Terminated" containerID = state.Terminated.ContainerID } - cid = containerID[9:21] + if containerID != "" { + cid = containerID[9:21] + } return }