DynamicTilemapLayer.destroy will now no longer run its destroy sequence again if it has already been run once. Fix #4634

This commit is contained in:
Richard Davey 2019-07-03 15:53:47 +01:00
parent da49fcc499
commit e012115df4
2 changed files with 13 additions and 1 deletions

View file

@ -458,6 +458,12 @@ var DynamicTilemapLayer = new Class({
{
if (removeFromTilemap === undefined) { removeFromTilemap = true; }
if (!this.tilemap)
{
// Abort, we've already been destroyed
return;
}
// Uninstall this layer only if it is still installed on the LayerData object
if (this.layer.tilemapLayer === this)
{

View file

@ -1446,7 +1446,13 @@ var StaticTilemapLayer = new Class({
{
if (removeFromTilemap === undefined) { removeFromTilemap = true; }
// Uninstall this layer only if it is still installed on the LayerData object
if (!this.tilemap)
{
// Abort, we've already been destroyed
return;
}
// Uninstall this layer only if it is still installed on the LayerData object
if (this.layer.tilemapLayer === this)
{
this.layer.tilemapLayer = undefined;