diff --git a/lib/OpenLayers/Popup.js b/lib/OpenLayers/Popup.js index 1c2ca8b8af..56e56aea39 100644 --- a/lib/OpenLayers/Popup.js +++ b/lib/OpenLayers/Popup.js @@ -81,8 +81,10 @@ OpenLayers.Popup.prototype = { * @type DOMElement */ draw: function(px) { - if ((px == null) && (this.map != null)) { - px = this.map.getLayerPxFromLonLat(this.lonlat); + if (px == null) { + if ((this.lonlat != null) && (this.map != null)) { + px = this.map.getLayerPxFromLonLat(this.lonlat); + } } if (this.div == null) { diff --git a/lib/OpenLayers/Popup/Anchored.js b/lib/OpenLayers/Popup/Anchored.js index c27569a083..2ee59e9e75 100644 --- a/lib/OpenLayers/Popup/Anchored.js +++ b/lib/OpenLayers/Popup/Anchored.js @@ -39,8 +39,10 @@ OpenLayers.Popup.Anchored.prototype = * @type DOMElement */ draw: function(px) { - if ((px == null) && (this.map != null)) { - px = this.map.getLayerPxFromLonLat(this.lonlat); + if (px == null) { + if ((this.lonlat != null) && (this.map != null)) { + px = this.map.getLayerPxFromLonLat(this.lonlat); + } } //calculate relative position