From f02b047f9a3a04c2101053d16660f66d4ac1b674 Mon Sep 17 00:00:00 2001 From: Oliver Gerlich Date: Sun, 22 Jul 2018 15:09:39 +0200 Subject: [PATCH] map: fix exception when enabling Clients layers The layer data array must not contain "null" entries. --- webroot/js/view/map.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/webroot/js/view/map.js b/webroot/js/view/map.js index 3165b53..d650eaf 100644 --- a/webroot/js/view/map.js +++ b/webroot/js/view/map.js @@ -141,19 +141,16 @@ export class MapView extends View { for (let i = 0; i < nodes.length; i += 1) { this.addNode(nodes[i]); } - this.clientLayer24.setData(nodes.map((node) => { - if (!node.location || !node.location.latitude || !node.location.longitude) { - return null; - } + this.clientLayer24.setData(nodes.filter((node) => { + return (node.location && node.location.latitude && node.location.longitude); + }).map((node) => { return [node.location.latitude, node.location.longitude, node.statistics.clients.wifi24 || 0]; })); - this.clientLayer5.setData(nodes.map((node) => { - if (!node.location || !node.location.latitude || !node.location.longitude) { - return null; - } - + this.clientLayer5.setData(nodes.filter((node) => { + return (node.location && node.location.latitude && node.location.longitude); + }).map((node) => { return [node.location.latitude, node.location.longitude, node.statistics.clients.wifi5 || 0]; })); this.map.invalidateSize();