Skip to content

Commit

Permalink
fix: Guard against the 0 gid case
Browse files Browse the repository at this point in the history
  • Loading branch information
eonarheim committed Jul 15, 2023
1 parent 30701dc commit 32bed99
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/tiled-map-resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,11 @@ export class TiledMapResource implements Loadable<TiledMap> {
const tiledLayer = this.data.getTileLayerByName(layerName);
const tileGid = getCanonicalGid(tiledLayer.data[tileIndex]);

// No tile case
if (tileGid === 0) {
return null;
}

// Tiled tileset properties
const tiledTileset = this.getTilesetForTile(tileGid);
// odd quirk of Tiled's data the gid's here are off by 1 from the data array :/
Expand Down

0 comments on commit 32bed99

Please sign in to comment.