From ce991b243442c90a632e28441d0ec47bae8c3995 Mon Sep 17 00:00:00 2001 From: Rob Gill Date: Thu, 26 Jun 2025 09:09:56 +1000 Subject: [PATCH] settings-system : Avoid division by zero in DNS metrics Don't attempt to calculate a percentage if there are no replies yet Signed-off-by: Rob Gill --- scripts/js/settings-system.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/js/settings-system.js b/scripts/js/settings-system.js index be292b1a..a70698e8 100644 --- a/scripts/js/settings-system.js +++ b/scripts/js/settings-system.js @@ -134,7 +134,7 @@ function setMetrics(data, prefix) { cacheData[val.name] = val.count; } else if (typeof val === "object") { setMetrics(val, prefix + key + "-"); - } else if (prefix === "sysinfo-dns-replies-") { + } else if (prefix === "sysinfo-dns-replies-" && data.sum !== 0) { // Compute and display percentage of DNS replies in addition to the absolute value const lval = val.toLocaleString(); const percent = (100 * val) / data.sum;