special precautions must be taken in updateBackBufferData

This commit is contained in:
Éric Lemoine
2011-10-19 23:47:25 +02:00
parent 7ffec2e88b
commit 76e8a800da

View File

@@ -490,10 +490,14 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
updateBackBufferData: function() {
// updateBackBufferData is called asynchronously when tiles are
// received, so we need to check that the map is still there
if (this.map) {
if(this.map) {
var resolution = this.map.getResolution();
this.backBufferData.resolution = this.getServerResolution(resolution);
var topLeftTile = this.grid[0][0];
}
// the top left tile might have been destroyed, so its bounds
// property may be null
var topLeftTile = this.grid[0][0];
if(topLeftTile.bounds) {
this.backBufferData.lonlat = {lon: topLeftTile.bounds.left,
lat: topLeftTile.bounds.top};
}