map: fix exception when enabling Clients layers

The layer data array must not contain "null" entries.
This commit is contained in:
Oliver Gerlich 2018-07-22 15:09:39 +02:00
parent 668ba59b8d
commit f02b047f9a
1 changed files with 6 additions and 9 deletions

View File

@ -141,19 +141,16 @@ export class MapView extends View {
for (let i = 0; i < nodes.length; i += 1) { for (let i = 0; i < nodes.length; i += 1) {
this.addNode(nodes[i]); 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]; return [node.location.latitude, node.location.longitude, node.statistics.clients.wifi24 || 0];
})); }));
this.clientLayer5.setData(nodes.map((node) => { this.clientLayer5.setData(nodes.filter((node) => {
if (!node.location || !node.location.latitude || !node.location.longitude) { return (node.location && node.location.latitude && node.location.longitude);
return null; }).map((node) => {
}
return [node.location.latitude, node.location.longitude, node.statistics.clients.wifi5 || 0]; return [node.location.latitude, node.location.longitude, node.statistics.clients.wifi5 || 0];
})); }));
this.map.invalidateSize(); this.map.invalidateSize();