diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 52a2ab4e3a..8e7606c086 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -931,7 +931,11 @@ OpenLayers.Map.prototype = { * @private */ getLonLatFromViewPortPx: function (viewPortPx) { - return this.baseLayer.getLonLatFromViewPortPx(viewPortPx); + var lonlat = null; + if (this.baseLayer != null) { + lonlat = this.baseLayer.getLonLatFromViewPortPx(viewPortPx); + } + return lonlat; }, /** @@ -944,7 +948,11 @@ OpenLayers.Map.prototype = { * @private */ getViewPortPxFromLonLat: function (lonlat) { - return this.baseLayer.getViewPortPxFromLonLat(lonlat); + var px = null; + if (this.baseLayer != null) { + px = this.baseLayer.getViewPortPxFromLonLat(lonlat); + } + return px; },