From c25a20ff133d0ff9c865ac2cbc0076544cb4f16b Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 2 Jun 2008 12:45:24 +0000 Subject: [PATCH] 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. --- app/views/site/index.rhtml | 2 +- public/javascripts/map.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/views/site/index.rhtml b/app/views/site/index.rhtml index d6247158d..3e0400ce4 100644 --- a/app/views/site/index.rhtml +++ b/app/views/site/index.rhtml @@ -109,7 +109,7 @@ by the OpenStreetMap project and its contributors. setMapCenter(centre, zoom); <% end %> - <% if layers %> + <% if !layers.empty? %> setMapLayers("<%= layers %>"); <% end %> diff --git a/public/javascripts/map.js b/public/javascripts/map.js index 7591d7d16..9f9be0987 100644 --- a/public/javascripts/map.js +++ b/public/javascripts/map.js @@ -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); + } } } -- 2.43.2