From 1b22df2b7b3f19756466f8f04b72e81dd9cf681d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Tue, 9 Feb 2021 14:40:35 +0100 Subject: [PATCH] Handle undefined peerconn MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/webrtc/call.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/webrtc/call.ts b/src/webrtc/call.ts index eb6a12f62..d1d932744 100644 --- a/src/webrtc/call.ts +++ b/src/webrtc/call.ts @@ -521,6 +521,10 @@ export class MatrixCall extends EventEmitter { } private async collectCallStats(): Promise { + // This happens when the call fails before it starts. + // For example when we fail to get capture sources + if (!this.peerConn) return; + const statsReport = await this.peerConn.getStats(); const stats = []; for (const item of statsReport) {