From ebe90180727a3488952cc6fa07975ea41ebf099c Mon Sep 17 00:00:00 2001 From: Alfredo Cardigliano Date: Mon, 27 Jan 2025 16:25:04 +0100 Subject: [PATCH] Add safety checks --- scripts/lua/modules/graph_utils.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/lua/modules/graph_utils.lua b/scripts/lua/modules/graph_utils.lua index 5633534ba2ee..152762118cac 100644 --- a/scripts/lua/modules/graph_utils.lua +++ b/scripts/lua/modules/graph_utils.lua @@ -705,11 +705,11 @@ function graph_utils.merge_pie_data(aggregated_data, data, max_values) -- Note: aggregated_data may be nil local items = {} if aggregated_data then - for _, l in ipairs(aggregated_data.labels) do + for _, l in ipairs(aggregated_data.labels or {}) do items[l] = aggregated_data.series[_] end end - for _, l in ipairs(data.labels) do + for _, l in ipairs(data.labels or {}) do if items[l] then items[l] = items[l] + data.series[_] else