Making code more robust regarding scene being null in Character class
Not sure how this can happen but it does. Closes #1167
This commit is contained in:
parent
94333a7438
commit
dcd44f283f
1 changed files with 7 additions and 7 deletions
|
@ -94,7 +94,7 @@ export abstract class Character extends Container {
|
|||
|
||||
public addTextures(textures: string[], frame?: string | number): void {
|
||||
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');
|
||||
}
|
||||
const sprite = new Sprite(this.scene, 0, 0, texture, frame);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue