diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 18042517fb..b23ab7c9ee 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -182,15 +182,19 @@ OpenLayers.Map.prototype = { * @return {OpenLayers.Bounds} */ getExtent: function () { - var res = this.getResolution(); - var size = this.getSize(); - var w_deg = size.w * res; - var h_deg = size.h * res; - return new OpenLayers.Bounds( - this.center.lon - w_deg / 2, - this.center.lat - h_deg / 2, - this.center.lon + w_deg / 2, - this.center.lat + h_deg / 2); + if (this.center) { + var res = this.getResolution(); + var size = this.getSize(); + var w_deg = size.w * res; + var h_deg = size.h * res; + return new OpenLayers.Bounds( + this.center.lon - w_deg / 2, + this.center.lat - h_deg / 2, + this.center.lon + w_deg / 2, + this.center.lat + h_deg / 2); + } else { + return null; + } }, /**