mirror of
https://github.com/photonstorm/phaser
synced 2024-12-01 00:49:41 +00:00
Protect against zero and negative indexes (-1 is used in e.g. "blank tilemap" example).
This commit is contained in:
parent
49b3d1a57a
commit
5be5ddba25
1 changed files with 10 additions and 2 deletions
|
@ -244,7 +244,11 @@ PIXI.Tilemap.prototype._renderVisibleLayer = function( _layer, renderSession )
|
||||||
var layerRow = _layer.data[y];
|
var layerRow = _layer.data[y];
|
||||||
for(var x = firstX; x < lastX; x++)
|
for(var x = firstX; x < lastX; x++)
|
||||||
{
|
{
|
||||||
this._renderTile(gl, shader, x * this.tileWide, y * this.tileHigh, layerRow[x].index - 1);
|
var tile = layerRow[x].index - 1;
|
||||||
|
if ( tile > 0 )
|
||||||
|
{
|
||||||
|
this._renderTile(gl, shader, x * this.tileWide, y * this.tileHigh, tile - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +304,11 @@ PIXI.Tilemap.prototype._renderLayer = function( _layer, renderSession )
|
||||||
var layerRow = _layer.data[y];
|
var layerRow = _layer.data[y];
|
||||||
for(var x = 0; x < wide; x++)
|
for(var x = 0; x < wide; x++)
|
||||||
{
|
{
|
||||||
this._renderTile(gl, shader, x * this.tileWide, y * this.tileHigh, layerRow[x].index - 1);
|
var tile = layerRow[x].index - 1;
|
||||||
|
if ( tile > 0 )
|
||||||
|
{
|
||||||
|
this._renderTile(gl, shader, x * this.tileWide, y * this.tileHigh, tile - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue