From a77d675664f86df5bd32ee3eda088de81b36ad70 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 15 Dec 2020 18:01:42 +0000 Subject: [PATCH] Better null check to make tests happy --- src/CallHandler.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CallHandler.tsx b/src/CallHandler.tsx index 8bfd798f16..eaf56b935a 100644 --- a/src/CallHandler.tsx +++ b/src/CallHandler.tsx @@ -118,7 +118,7 @@ function getRemoteAudioElement(): HTMLAudioElement { export default class CallHandler { private calls = new Map(); // roomId -> call private audioPromises = new Map>(); - private dispatcherRef: string; + private dispatcherRef: string = null; static sharedInstance() { if (!window.mxCallHandler) { @@ -152,7 +152,7 @@ export default class CallHandler { if (cli) { cli.removeListener('Call.incoming', this.onCallIncoming); } - if (this.dispatcherRef) dis.unregister(this.dispatcherRef); + if (this.dispatcherRef !== null) dis.unregister(this.dispatcherRef); } private onCallIncoming = (call) => {