diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 3ce70f9b03..8273ca3407 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -531,8 +531,12 @@ OpenLayers.Map.prototype = { * @type String */ getProjection: function() { - var projection = this.baseLayer.getProjection(); - + var projection = null; + + if (this.baseLayer != null) { + projection = this.baseLayer.getProjection(); + } + if (projection == null) { projection = this.projection; } @@ -545,7 +549,11 @@ OpenLayers.Map.prototype = { * @type String */ getMaxResolution: function() { - var maxResolution = this.baseLayer.getMaxResolution(); + var maxResolution = null + + if (this.baseLayer != null) { + maxResolution = this.baseLayer.getMaxResolution(); + } if (maxResolution == null) { maxResolution = this.maxResolution; @@ -558,12 +566,16 @@ OpenLayers.Map.prototype = { * @type OpenLayers.Bounds */ getMaxExtent: function () { - var maxExtent = this.baseLayer.getMaxExtent(); + var maxExtent = null; + + if (this.baseLayer != null) { + maxExtent = this.baseLayer.getMaxExtent(); + } if (maxExtent == null) { maxExtent = this.maxExtent; } - + return maxExtent; }, @@ -572,10 +584,16 @@ OpenLayers.Map.prototype = { * @type int */ getMaxZoomLevel: function() { - var maxZoomLevel = this.baseLayer.getMaxZoomLevel(); + var maxZoomLevel = null; + + if (this.baseLayer != null) { + maxZoomLevel = this.baseLayer.getMaxZoomLevel(); + } + if (maxZoomLevel == null) { maxZoomLevel = this.maxZoomLevel; } + return maxZoomLevel; }, @@ -584,10 +602,16 @@ OpenLayers.Map.prototype = { * @type int */ getMinZoomLevel: function() { - var minZoomLevel = this.baseLayer.getMinZoomLevel(); + var minZoomLevel = null; + + if (this.baseLayer != null) { + minZoomLevel = this.baseLayer.getMinZoomLevel(); + } + if (minZoomLevel == null) { minZoomLevel = this.minZoomLevel; } + return minZoomLevel; },