Skip to content

Commit f1cb146

Browse files
committed
Add a check around an optional function
My game crashes here if I update phaser.js to a new version. It happens when my game switches to another State object.
1 parent 6a0b8b5 commit f1cb146

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/core/StateManager.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,10 @@ Phaser.StateManager.prototype = {
307307
// Already got a state running?
308308
if (this.current)
309309
{
310-
this.onShutDownCallback.call(this.callbackContext, this.game);
310+
if (this.onShutDownCallback)
311+
{
312+
this.onShutDownCallback.call(this.callbackContext, this.game);
313+
}
311314

312315
this.game.tweens.removeAll();
313316

0 commit comments

Comments
 (0)