only remove listener if scene was not already destroyed

This commit is contained in:
Johannes Berthel 2021-04-02 21:29:45 +02:00
parent e4d324e5fa
commit 4cfce15695

View File

@ -212,7 +212,9 @@ export class Companion extends Container {
}
}
this.scene.events.removeListener('update', this.step, this);
if (this.scene) {
this.scene.events.removeListener('update', this.step, this);
}
super.destroy();
}