From 1f020e9e544f285329f8aa1831aa13d9d5c02259 Mon Sep 17 00:00:00 2001 From: cigamit Date: Tue, 16 Apr 2019 20:52:14 -0500 Subject: [PATCH] Resolving Issue #2589 DSStats throws errors when RRDfile has not been created --- CHANGELOG | 1 + lib/graph_variables.php | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 4ba973e875..e1161e2bf3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Cacti CHANGELOG 1.2.4 +-issue#2589: DSStats throws errors when RRDfile has not been created -issue#2590: Language selection is not working as expected -issue#2592: Display graphs from this aggregate can not work -issue#2593: Can not migrate aggregate to use a template diff --git a/lib/graph_variables.php b/lib/graph_variables.php index f24c66bd8a..e999db5ccd 100644 --- a/lib/graph_variables.php +++ b/lib/graph_variables.php @@ -144,13 +144,15 @@ function nth_percentile_fetch_statistics($percentile, &$local_data_ids, &$fetch_ $asum_array = array(); foreach ($local_data_ids as $ldi => $data_source_name) { - if (isset($fetch_array[$ldi]['data_source_names'])) { + if (cacti_sizeof($fetch_array[$ldi]['data_source_names'])) { foreach ($fetch_array[$ldi]['data_source_names'] as $index => $ds_name) { - foreach ($fetch_array[$ldi]['values'][$index] as $timestamp => $data) { - if (isset($asum_array[$ds_name][$timestamp])) { - $asum_array[$ds_name][$timestamp] += $data; - } else { - $asum_array[$ds_name][$timestamp] = $data; + if (cacti_sizeof($fetch_array[$ldi]['values'][$index])) { + foreach ($fetch_array[$ldi]['values'][$index] as $timestamp => $data) { + if (isset($asum_array[$ds_name][$timestamp])) { + $asum_array[$ds_name][$timestamp] += $data; + } else { + $asum_array[$ds_name][$timestamp] = $data; + } } } }