From 621026cbdf65ada02f8612e05741e37fe097edba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=A5=96=E5=BB=BA?= Date: Sun, 28 Apr 2024 12:54:40 +0800 Subject: [PATCH] fix index out of range (#3958) Signed-off-by: zhangzujian --- pkg/pinger/config.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/pinger/config.go b/pkg/pinger/config.go index e1d3b1d3b2f..69730ffcd9d 100644 --- a/pkg/pinger/config.go +++ b/pkg/pinger/config.go @@ -169,8 +169,8 @@ func ParseFlags() (*Configuration, error) { break } - if pod.Status.ContainerStatuses[0].Ready { - util.LogFatalAndExit(nil, "failed to get IPs of Pod %s/%s", config.DaemonSetNamespace, podName) + if len(pod.Status.ContainerStatuses) != 0 && pod.Status.ContainerStatuses[0].Ready { + util.LogFatalAndExit(nil, "failed to get IPs of Pod %s/%s: podIPs is empty while the container is ready", config.DaemonSetNamespace, podName) } klog.Infof("cannot get Pod IPs now, waiting Pod to be ready")