Don't try and look at params.layers when it isn't set
authorTom Hughes <tom@compton.nu>
Fri, 19 Jul 2013 11:12:58 +0000 (12:12 +0100)
committerTom Hughes <tom@compton.nu>
Fri, 19 Jul 2013 11:12:58 +0000 (12:12 +0100)
app/assets/javascripts/index/notes.js.erb

index 2d807eb92e6ccab6554f6249587aada0cf5c11c2..d0f6cb3885d9de336937da4e340fade650145f3e 100644 (file)
@@ -50,7 +50,10 @@ function initializeNotes(map) {
   });
 
   if (OSM.STATUS != 'api_offline' && OSM.STATUS != 'database_offline') {
-    if (params.notes || params.layers.indexOf('N') >= 0) map.addLayer(noteLayer);
+    if (params.notes || (params.layers && params.layers.indexOf('N')) >= 0) {
+      map.addLayer(noteLayer);
+    }
+
     if (params.note) {
       $.ajax({
         url: "/api/" + OSM.API_VERSION + "/notes/" + params.note + ".json",