Skip to content

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

@robbeman

Description

@robbeman

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions