Merge pull request #1177 from thecodingmachine/bugfix/1167

Making code more robust regarding scene being null in Character class
This commit is contained in:
David Négrier 2021-06-14 16:54:12 +02:00 committed by GitHub
commit f16514db21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);