MousePosition control throws error when no layers are on map. Fix it so that

they don't. Thanks for the review, fredj. Includes tests. (Closes #1029)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@5371 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-12-11 07:27:45 +00:00
parent b105017586
commit 354817649d
2 changed files with 21 additions and 0 deletions

View File

@@ -108,6 +108,10 @@ OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, {
}
lonLat = this.map.getLonLatFromPixel(evt.xy);
if (!lonLat) {
// map has not yet been properly initialized
return;
}
this.lastXy = evt.xy;
}