From 36ec579e39fb69907cc7cb9850c2f105305b3c59 Mon Sep 17 00:00:00 2001 From: euzuro Date: Thu, 17 Aug 2006 17:20:30 +0000 Subject: [PATCH] protect viewport-lonlat translation functions in the case no baselayer is defined git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1283 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Map.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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; },