Merge pull request #1177 from thecodingmachine/bugfix/1167
Making code more robust regarding scene being null in Character class
This commit is contained in:
commit
f16514db21
@ -94,7 +94,7 @@ export abstract class Character extends Container {
|
|||||||
|
|
||||||
public addTextures(textures: string[], frame?: string | number): void {
|
public addTextures(textures: string[], frame?: string | number): void {
|
||||||
for (const texture of textures) {
|
for (const texture of textures) {
|
||||||
if(!this.scene.textures.exists(texture)){
|
if(this.scene && !this.scene.textures.exists(texture)){
|
||||||
throw new TextureError('texture not found');
|
throw new TextureError('texture not found');
|
||||||
}
|
}
|
||||||
const sprite = new Sprite(this.scene, 0, 0, texture, frame);
|
const sprite = new Sprite(this.scene, 0, 0, texture, frame);
|
||||||
|
Loading…
Reference in New Issue
Block a user