Loader.preloadSprite had an extra guard added to ensure it didn't try to updateCrop a non-existent sprite (thanks @noidexe #1636)

This commit is contained in:
photonstorm 2015-02-25 03:08:37 +00:00
parent eb8e99021b
commit 466a4d11bb
2 changed files with 10 additions and 1 deletions

View file

@ -189,6 +189,7 @@ We've also removed functions and properties from Pixi classes that Phaser doesn'
* Graphics.drawEllipse method was missing (thanks @jackrugile #1574)
* A TweenData wouldn't take into account the `repeatDelay` property when repeating the tween, but now does. A TweenData also has a new property `yoyoDelay` which controls the delay before the yoyo will start, allowing you to set both independently (thanks @DreadKnight #1469)
* Animation.update skips ahead frames when the system is lagging, however it failed to set the animation to the final frame in the sequence if the animation skipped ahead too far (thanks @richpixel #1628)
* Loader.preloadSprite had an extra guard added to ensure it didn't try to updateCrop a non-existent sprite (thanks @noidexe #1636)
For changes in previous releases please see the extensive [Version History](https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md).

View file

@ -2161,7 +2161,15 @@ Phaser.Loader.prototype = {
this.preloadSprite.rect.height = Math.floor((this.preloadSprite.height / 100) * this.progress);
}
this.preloadSprite.sprite.updateCrop();
if (this.preloadSprite.sprite)
{
this.preloadSprite.sprite.updateCrop();
}
else
{
// We seem to have lost our sprite - maybe it was destroyed?
this.preloadSprite = null;
}
}
},