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:
Tom Hughes 2008-06-02 12:45:24 +00:00
parent 48000eb09a
commit c25a20ff13
2 changed files with 6 additions and 2 deletions

View file

@ -109,7 +109,7 @@ by the OpenStreetMap project and its contributors.
setMapCenter(centre, zoom);
<% end %>
<% if layers %>
<% if !layers.empty? %>
setMapLayers("<%= layers %>");
<% end %>

View file

@ -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);
}
}
}