From 4cfce15695fef93e02799575cb7e4822f7c5d7c4 Mon Sep 17 00:00:00 2001 From: Johannes Berthel Date: Fri, 2 Apr 2021 21:29:45 +0200 Subject: [PATCH] only remove listener if scene was not already destroyed --- front/src/Phaser/Companion/Companion.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/front/src/Phaser/Companion/Companion.ts b/front/src/Phaser/Companion/Companion.ts index 407b7326..2d11110e 100644 --- a/front/src/Phaser/Companion/Companion.ts +++ b/front/src/Phaser/Companion/Companion.ts @@ -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(); }