Skip to content

Commit 34ab262

Browse files
committed
FlxTilemap.overlapsWithCallback(): fix out-of-bounds array access on html5
The logic was based on the assumption that an out-of-bounds-access on an integer array returns 0, which is not the case on js, where it's null / undefined
1 parent 8eeda79 commit 34ab262

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

flixel/tile/FlxTilemap.hx

+3-3
Original file line numberDiff line numberDiff line change
@@ -960,13 +960,13 @@ class FlxTilemap extends FlxObject
960960

961961
while (column < selectionWidth)
962962
{
963-
var dataIndex:Int = _data[rowStart + column];
964-
965-
if (dataIndex < 0)
963+
var index:Int = rowStart + column;
964+
if ((index < 0) || (index > _data.length - 1))
966965
{
967966
column++;
968967
continue;
969968
}
969+
var dataIndex:Int = _data[index];
970970

971971
tile = _tileObjects[dataIndex];
972972
tile.width = _scaledTileWidth;

0 commit comments

Comments
 (0)