Skip to content

Commit 466a4d1

Browse files
committed
Loader.preloadSprite had an extra guard added to ensure it didn't try to updateCrop a non-existent sprite (thanks @noidexe phaserjs#1636)
1 parent eb8e990 commit 466a4d1

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ We've also removed functions and properties from Pixi classes that Phaser doesn'
189189
* Graphics.drawEllipse method was missing (thanks @jackrugile #1574)
190190
* 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)
191191
* 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)
192+
* Loader.preloadSprite had an extra guard added to ensure it didn't try to updateCrop a non-existent sprite (thanks @noidexe #1636)
192193

193194
For changes in previous releases please see the extensive [Version History](https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md).
194195

src/loader/Loader.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2161,7 +2161,15 @@ Phaser.Loader.prototype = {
21612161
this.preloadSprite.rect.height = Math.floor((this.preloadSprite.height / 100) * this.progress);
21622162
}
21632163

2164-
this.preloadSprite.sprite.updateCrop();
2164+
if (this.preloadSprite.sprite)
2165+
{
2166+
this.preloadSprite.sprite.updateCrop();
2167+
}
2168+
else
2169+
{
2170+
// We seem to have lost our sprite - maybe it was destroyed?
2171+
this.preloadSprite = null;
2172+
}
21652173
}
21662174

21672175
},

0 commit comments

Comments
 (0)