diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index d2565aca0c..a0e064a8bf 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -267,8 +267,8 @@ OpenLayers.Layer.Grid.prototype = // if the test grid coordinates are within the bounds of the // grid, get a reference to the tile. var tile = null; - if ((testRow < this.grid.length) && - (testCell < this.grid[0].length)) { + if ((testRow < this.grid.length) && (testRow >= 0) && + (testCell < this.grid[0].length) && (testCell >= 0)) { tile = this.grid[testRow][testCell]; }