From ae735a1189969afb7b66a7785cb5d7dd1729e9d2 Mon Sep 17 00:00:00 2001 From: Dave Chen Date: Tue, 16 Jun 2020 13:23:05 +0800 Subject: [PATCH] scheduler_perf: fix the nil pointer dereference Signed-off-by: Dave Chen --- test/integration/scheduler_perf/util.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/integration/scheduler_perf/util.go b/test/integration/scheduler_perf/util.go index f0cd294da8a..e440f88c0e7 100644 --- a/test/integration/scheduler_perf/util.go +++ b/test/integration/scheduler_perf/util.go @@ -179,7 +179,10 @@ func collectHistogram(metric string, labels map[string]string) *DataItem { klog.Error(err) return nil } - + if hist.Histogram == nil { + klog.Errorf("metric %q is not a Histogram metric", metric) + return nil + } if err := hist.Validate(); err != nil { klog.Error(err) return nil