mirror of
https://github.com/photonstorm/phaser
synced 2024-11-29 08:01:04 +00:00
MapData
and ObjectLayer
will now enforce that the Tilemap.objects
property is always an array. Sometimes Tiled willl set it to be a blank object in the JSON data. This fix makes sure it is always an array. Fix #6139
This commit is contained in:
parent
eec8b6a507
commit
759599e4d1
2 changed files with 13 additions and 1 deletions
|
@ -178,8 +178,14 @@ var MapData = new Class({
|
|||
*/
|
||||
this.objects = GetFastValue(config, 'objects', []);
|
||||
|
||||
// Because Tiled can sometimes create an empty object if you don't populate it, not an empty array
|
||||
if (!Array.isArray(this.objects))
|
||||
{
|
||||
this.objects = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* An object of collision data. Must be created as physics object or will return undefined.
|
||||
* An object of collision data. Must be created as physics object or will return undefined.
|
||||
*
|
||||
* @name Phaser.Tilemaps.MapData#collision
|
||||
* @type {object}
|
||||
|
|
|
@ -109,6 +109,12 @@ var ObjectLayer = new Class({
|
|||
* @since 3.0.0
|
||||
*/
|
||||
this.objects = GetFastValue(config, 'objects', []);
|
||||
|
||||
// Because Tiled can sometimes create an empty object if you don't populate it, not an empty array
|
||||
if (!Array.isArray(this.objects))
|
||||
{
|
||||
this.objects = [];
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue