- if ( is_reverse_search ){
- // make sure the search coordinates are in the map view as well
- map.fitBounds([[result.lat,result.lon], [nominatim_map_init.lat,nominatim_map_init.lon]], {padding: [50,50], maxZoom: map.getZoom()});
-
- // better, but causes a leaflet warning
- // map.panInsideBounds([[result.lat,result.lon], [nominatim_map_init.lat,nominatim_map_init.lon]], {animate: false});
- }
- else {
- map.panTo([result.lat,result.lon], result.zoom || nominatim_map_init.zoom);
+ var result_coord = L.latLng(result.lat, result.lon);
+ if ( result_coord ){
+ if ( is_reverse_search ){
+ // make sure the search coordinates are in the map view as well
+ map.fitBounds([result_coord, [nominatim_map_init.lat,nominatim_map_init.lon]], {padding: [50,50], maxZoom: map.getZoom()});
+
+ // better, but causes a leaflet warning
+ // map.panInsideBounds([[result.lat,result.lon], [nominatim_map_init.lat,nominatim_map_init.lon]], {animate: false});
+ }
+ else {
+ map.panTo(result_coord, result.zoom || nominatim_map_init.zoom);
+ }