phaser icon indicating copy to clipboard operation
phaser copied to clipboard

Tilemap objects property is not always an array (as it is typed)

Open robbeman opened this issue 3 years ago • 0 comments

When only empty object layers are added in Tiled, this is an empty object instead of an empty array.

https://github.com/photonstorm/phaser/blob/1a086fc57c8faa53885fd1a4e20d617b958d3677/src/tilemaps/Tilemap.js#L260

Suggested solution:

  this.objects = Array.isArray(mapData.objects) ? mapData.objects : [];

Maybe a little short-sighted? On the other hand, my game crashed because I relied on the type comment.

robbeman avatar Jun 10 '22 14:06 robbeman