Skip to content

armgit / mwmbl

Public Imported from GitHub
0

An open source, non-profit web search engine

Fix stats page crash when API returns empty daily dicts

Daoud Clarke5c841bf64dc5
diff --git a/front-end/src/stats/stats.js b/front-end/src/stats/stats.js
index 744e49a..d46f11b 100644
--- a/front-end/src/stats/stats.js
+++ b/front-end/src/stats/stats.js
@@ -77,6 +77,7 @@ import {Chart} from "chart.js/auto";
function numberWithCommas(x) {
// From https://stackoverflow.com/a/2901298/660902
+ if (x == null) return "0";
return x.toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ",");
}