Don't try and parse an empty string as a layer config, and cope a bit
better if we do hit the end of the string. Closes #942.
This commit is contained in:
parent
48000eb09a
commit
c25a20ff13
2 changed files with 6 additions and 2 deletions
|
@ -109,7 +109,7 @@ by the OpenStreetMap project and its contributors.
|
|||
setMapCenter(centre, zoom);
|
||||
<% end %>
|
||||
|
||||
<% if layers %>
|
||||
<% if !layers.empty? %>
|
||||
setMapLayers("<%= layers %>");
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -155,7 +155,11 @@ function setMapLayers(layerConfig) {
|
|||
for (var layers = map.getLayersBy("isBaseLayer", false), i = 0; i < layers.length; i++) {
|
||||
var c = layerConfig.charAt(l++);
|
||||
|
||||
layers[i].setVisibility(c == "T");
|
||||
if (c == "T") {
|
||||
layers[i].setVisibility(true);
|
||||
} else if(c == "F") {
|
||||
layers[i].setVisibility(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue