From dd470d49ec6c3533eb197da131580c065979d09d Mon Sep 17 00:00:00 2001 From: Christoph Kluge Date: Thu, 30 Jan 2025 11:55:40 +0100 Subject: [PATCH] fix potential crash cause due to index oor on empty ccms return --- internal/metricdata/cc-metric-store.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/metricdata/cc-metric-store.go b/internal/metricdata/cc-metric-store.go index 8d2d3f5..5db7583 100644 --- a/internal/metricdata/cc-metric-store.go +++ b/internal/metricdata/cc-metric-store.go @@ -207,9 +207,9 @@ func (ccms *CCMetricStore) LoadData( jobData[metric] = make(map[schema.MetricScope]*schema.JobMetric) } - res := row[0].Resolution - if res == 0 { - res = mc.Timestep + res := mc.Timestep + if len(row) > 0 { + res = row[0].Resolution } jobMetric, ok := jobData[metric][scope] @@ -784,9 +784,9 @@ func (ccms *CCMetricStore) LoadNodeListData( scope := assignedScope[i] mc := archive.GetMetricConfig(cluster, metric) - res := row[0].Resolution - if res == 0 { - res = mc.Timestep + res := mc.Timestep + if len(row) > 0 { + res = row[0].Resolution } // Init Nested Map Data Structures If Not Found