From 3d83fda69fc5fba9c3f184b06bcb11f27c7ab9f4 Mon Sep 17 00:00:00 2001 From: Bruno Windels <274386+bwindels@users.noreply.github.com> Date: Thu, 28 Apr 2022 16:52:17 +0100 Subject: [PATCH] some more cleanup --- src/matrix/calls/group/Member.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/matrix/calls/group/Member.ts b/src/matrix/calls/group/Member.ts index 694201a9..d6951fb8 100644 --- a/src/matrix/calls/group/Member.ts +++ b/src/matrix/calls/group/Member.ts @@ -123,7 +123,9 @@ export class Member { this.peerCall = undefined; this.localMedia?.dispose(); this.localMedia = undefined; + this.localMuteSettings = undefined; this.retryCount = 0; + this.logItem.finish(); }); } @@ -158,8 +160,12 @@ export class Member { /** @internal */ emitUpdate = (peerCall: PeerCall, params: any) => { + // these must be set as the update comes from the peerCall, + // which only exists when these are set + const localMedia = this.localMedia!; + const localMuteSettings = this.localMuteSettings!; if (peerCall.state === CallState.Ringing) { - peerCall.answer(this.localMedia!, this.localMuteSettings!); + peerCall.answer(localMedia, localMuteSettings); } else if (peerCall.state === CallState.Ended) { const hangupReason = peerCall.hangupReason; @@ -168,7 +174,7 @@ export class Member { if (hangupReason && !errorCodesWithoutRetry.includes(hangupReason)) { this.retryCount += 1; if (this.retryCount <= 3) { - this.connect(this.localMedia!, this.localMuteSettings!); + this.connect(localMedia, localMuteSettings); } } }