Skip to content

Commit 5b59bf8

Browse files
committed
hopefully fix leaflet crashing
1 parent b9cdce5 commit 5b59bf8

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

js/sondehub.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -928,8 +928,8 @@ function sidebar_update() {
928928
} else {
929929
if (!($("#main .vehicle"+vehicles[serial].uuid).hasClass("follow"))) {
930930
$("#main .vehicle"+vehicles[serial].uuid).hide();
931-
map.removeLayer(vehicles[serial].marker);
932-
map.removeLayer(vehicles[serial].marker_shadow);
931+
if (vehicles[serial].marker) map.removeLayer(vehicles[serial].marker);
932+
if (vehicles[serial].marker_shadow) map.removeLayer(vehicles[serial].marker_shadow);
933933
set_polyline_visibility(serial,false)
934934
}
935935
}
@@ -947,8 +947,8 @@ function sidebar_update() {
947947

948948
} else {
949949
$("#main .vehicle"+vehicles[serial].uuid).hide();
950-
map.removeLayer(vehicles[serial].marker);
951-
map.removeLayer(vehicles[serial].marker_shadow);
950+
if (vehicles[serial].marker) map.removeLayer(vehicles[serial].marker);
951+
if (vehicles[serial].marker_shadow) map.removeLayer(vehicles[serial].marker_shadow);
952952
set_polyline_visibility(serial,false)
953953
}
954954

@@ -4168,10 +4168,10 @@ function refreshUI() {
41684168
function hideHorizonRings(){
41694169
for(var vcallsign in vehicles) {
41704170
if(vehicles[vcallsign].vehicle_type == "balloon"){
4171-
map.removeLayer(vehicles[vcallsign].horizon_circle);
4172-
map.removeLayer(vehicles[vcallsign].subhorizon_circle);
4173-
map.removeLayer(vehicles[vcallsign].horizon_circle_title);
4174-
map.removeLayer(vehicles[vcallsign].subhorizon_circle_title);
4171+
if (vehicles[vcallsign].horizon_circle) map.removeLayer(vehicles[vcallsign].horizon_circle);
4172+
if (vehicles[vcallsign].subhorizon_circle) map.removeLayer(vehicles[vcallsign].subhorizon_circle);
4173+
if (vehicles[vcallsign].horizon_circle_titl) map.removeLayer(vehicles[vcallsign].horizon_circle_title);
4174+
if (vehicles[vcallsign].subhorizon_circle_title) map.removeLayer(vehicles[vcallsign].subhorizon_circle_title);
41754175
}
41764176
}
41774177
}
@@ -4184,10 +4184,10 @@ function showHorizonRings(){
41844184
map.addLayer(vehicles[vcallsign].horizon_circle_title);
41854185
map.addLayer(vehicles[vcallsign].subhorizon_circle_title);
41864186
} else if ( vehicles[vcallsign].vehicle_type == "balloon" ) {
4187-
map.removeLayer(vehicles[vcallsign].horizon_circle);
4188-
map.removeLayer(vehicles[vcallsign].subhorizon_circle);
4189-
map.removeLayer(vehicles[vcallsign].horizon_circle_title);
4190-
map.removeLayer(vehicles[vcallsign].subhorizon_circle_title);
4187+
if (vehicles[vcallsign].horizon_circle) map.removeLayer(vehicles[vcallsign].horizon_circle);
4188+
if (vehicles[vcallsign].subhorizon_circle) map.removeLayer(vehicles[vcallsign].subhorizon_circle);
4189+
if (vehicles[vcallsign].horizon_circle_title) map.removeLayer(vehicles[vcallsign].horizon_circle_title);
4190+
if (vehicles[vcallsign].subhorizon_circle_title) map.removeLayer(vehicles[vcallsign].subhorizon_circle_title);
41914191
}
41924192
}
41934193
}

0 commit comments

Comments
 (0)