From a28a1403c6412df8953b9af7390458ca13fb8341 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Sun, 22 Mar 2015 00:20:06 +0100 Subject: [PATCH] don't fail when newnodes and lostnodes are empty --- history.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/history.js b/history.js index 18bbece..1d672d8 100644 --- a/history.js +++ b/history.js @@ -235,7 +235,13 @@ function mkmap(map, newnodes, lostnodes, onlinenodes, graph, showNodeinfo, showL var group = L.featureGroup(markers).addTo(map) var group_online = L.featureGroup(onlinemarkers).addTo(map) - map.fitBounds(group.getBounds(), {paddingTopLeft: [getSidebarWidth(), 0]}) + var bounds = group.getBounds() + + if (!bounds.isValid()) + bounds = group_online.getBounds() + + if (bounds.isValid()) + map.fitBounds(bounds, {paddingTopLeft: [getSidebarWidth(), 0]}) var funcDict = {}