[missions] Bugfix: plugin would break and show weird dialogs if the mission markers aren't enabled

This commit is contained in:
fkloft 2015-06-04 00:55:48 +02:00
parent 96a8a94d48
commit 4146d46e5b

View File

@ -785,12 +785,15 @@ window.plugin.missions = {
},
highlightMissionLayers: function(markers) {
// layer.bringToFront() will break if the layer is not visible
var bringToFront = map.hasLayer(plugin.missions.missionLayer);
this.missionLayer.eachLayer(function(layer) {
var active = (markers.indexOf(layer) !== -1);
layer.setStyle({
color: active ? this.MISSION_COLOR_ACTIVE : this.MISSION_COLOR,
});
if(active) layer.bringToFront();
if(active && bringToFront) layer.bringToFront();
}, this);
},