Game.destroy now checks to see if the renderer exists before calling destroy on it. Fix #3498

This commit is contained in:
Richard Davey 2018-04-03 15:41:02 +01:00
parent d80cccc7f0
commit d838097763
2 changed files with 6 additions and 2 deletions

View file

@ -30,6 +30,7 @@ being passed to the simulation. The default value is 1 to remain consistent with
* The Gamepad Axis `getValue` method now correctly applies the threshold and zeroes out the returned value.
* The HueToComponent module was not correctly exporting itself. Fix #3482 (thanks @jdotrjs)
* Matter.World was using `setZ` instead of `setDepth` for the Debug Graphics Layer, causing it to appear behind objects in some display lists.
* Game.destroy now checks to see if the `renderer` exists before calling destroy on it. Fix #3498 (thanks @Huararanga)
### Updates

View file

@ -538,7 +538,10 @@ var Game = new Class({
this.scene.destroy();
this.renderer.destroy();
if (this.renderer)
{
this.renderer.destroy();
}
this.events.emit('destroy');
@ -546,7 +549,7 @@ var Game = new Class({
this.onStepCallback = null;
if (removeCanvas)
if (removeCanvas && this.canvas)
{
CanvasPool.remove(this.canvas);
}