Headless tilesprite crash fix

Fixes issue https://github.com/photonstorm/phaser/issues/4297
This commit is contained in:
Cédric Lesquir 2019-01-19 16:50:36 -05:00 committed by GitHub
parent 4c24799eac
commit cd6488e8db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -420,7 +420,7 @@ var TileSprite = new Class({
var fw = this.potWidth; var fw = this.potWidth;
var fh = this.potHeight; var fh = this.potHeight;
if (!this.renderer.gl) if (!this.renderer || !this.renderer.gl)
{ {
fw = frame.cutWidth; fw = frame.cutWidth;
fh = frame.cutHeight; fh = frame.cutHeight;
@ -439,7 +439,7 @@ var TileSprite = new Class({
fw, fh fw, fh
); );
if (this.renderer.gl) if (this.renderer && this.renderer.gl)
{ {
this.fillPattern = this.renderer.canvasToTexture(canvas, this.fillPattern); this.fillPattern = this.renderer.canvasToTexture(canvas, this.fillPattern);
} }