fix potential crash cause due to index oor on empty ccms return

This commit is contained in:
Christoph Kluge 2025-01-30 11:55:40 +01:00
parent 95d8062b00
commit dd470d49ec

View File

@ -207,9 +207,9 @@ func (ccms *CCMetricStore) LoadData(
jobData[metric] = make(map[schema.MetricScope]*schema.JobMetric) jobData[metric] = make(map[schema.MetricScope]*schema.JobMetric)
} }
res := row[0].Resolution res := mc.Timestep
if res == 0 { if len(row) > 0 {
res = mc.Timestep res = row[0].Resolution
} }
jobMetric, ok := jobData[metric][scope] jobMetric, ok := jobData[metric][scope]
@ -784,9 +784,9 @@ func (ccms *CCMetricStore) LoadNodeListData(
scope := assignedScope[i] scope := assignedScope[i]
mc := archive.GetMetricConfig(cluster, metric) mc := archive.GetMetricConfig(cluster, metric)
res := row[0].Resolution res := mc.Timestep
if res == 0 { if len(row) > 0 {
res = mc.Timestep res = row[0].Resolution
} }
// Init Nested Map Data Structures If Not Found // Init Nested Map Data Structures If Not Found