From 5b211897ecae850d0496a868718541a3d148ef2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Tue, 9 Feb 2021 14:52:48 +0100 Subject: [PATCH] Handle undefined call stats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/CallHandler.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/CallHandler.tsx b/src/CallHandler.tsx index a6d3534fa1..41a5941092 100644 --- a/src/CallHandler.tsx +++ b/src/CallHandler.tsx @@ -427,6 +427,13 @@ export default class CallHandler { `our Party ID: ${call.ourPartyId}, hangup party: ${call.hangupParty}, ` + `hangup reason: ${call.hangupReason}`, ); + if (!stats) { + logger.debug( + "Call statistics are undefined. The call has " + + "probably failed before a peerConn was established", + ); + return; + } logger.debug("Local candidates:"); for (const cand of stats.filter(item => item.type === 'local-candidate')) { const address = cand.address || cand.ip; // firefox uses 'address', chrome uses 'ip'