phaserjs / phaser-ce

Phaser CE is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.

Home Page:http://phaser.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`Cannot read property 'loadUpdate' of null` when destroying the game too early

jf-m opened this issue · comments

This Issue is about

  • A bug in the API:
    • Phaser version(s): 2.15.0
    • Live example: /
    • What steps produce the bug: Load and destroy the scene before the loader has finised loading the assets
    • What should happen: No error should be thrown
    • What happens instead: An error is thrown
    • If there's an error:
      • What's the error message?Cannot read property 'loadUpdate' of null
      • What's the error trace (expand the error message)? Phaser.Loader.finishedLoading

Hello and thank you for maintaining this repo !

This problem comes from the following line :
https://github.com/photonstorm/phaser-ce/blob/8f6296def883334faefa4aaf618c81eac4c3a7f3/src/loader/Loader.js#L2181

I think an if statement should be placed at this place, exactly the same way as 3 lines after :

https://github.com/photonstorm/phaser-ce/blob/8f6296def883334faefa4aaf618c81eac4c3a7f3/src/loader/Loader.js#L2188-L2192

Indeed, the case is well handled on loadComplete but not on loadUpdate.

Thank you very much, hope this helps