From 4cf0f4d6ff9ae4abace3555b696a1ebc33891dbe Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 2 Apr 2018 22:29:38 +0200 Subject: [PATCH] Make sure the properties exist when looping over objects Signed-off-by: DL6ER --- scripts/pi-hole/js/index.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 75b275b5..f9452cbd 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -187,8 +187,11 @@ function updateQueryTypesPie() { var meta = ci.data.datasets[0]._meta; for(let i in meta) { - var curr = meta[i].data[index]; - curr.hidden = !curr.hidden; + if ({}.hasOwnProperty.call(meta, i)) + { + var curr = meta[i].data[index]; + curr.hidden = !curr.hidden; + } } ci.update(); }); @@ -415,8 +418,11 @@ function updateForwardDestinationsPie() { var meta = ci.data.datasets[0]._meta; for(let i in meta) { - var curr = meta[i].data[index]; - curr.hidden = !curr.hidden; + if ({}.hasOwnProperty.call(meta, i)) + { + var curr = meta[i].data[index]; + curr.hidden = !curr.hidden; + } } ci.update(); });