Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
robbeman opened this issue Jun 10, 2022 · 1 comment
Closed

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

robbeman opened this issue Jun 10, 2022 · 1 comment

Comments

@robbeman
Copy link

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.

@photonstorm
Copy link
Collaborator

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants