From 2fcf136fa3d3a48ca0c89648f8d687a31f24f499 Mon Sep 17 00:00:00 2001 From: pabloFuente Date: Wed, 9 Jun 2021 15:14:25 +0200 Subject: [PATCH] openvidu-browser: fix disposeWebRtcPeer exception when no WebRtcPeer is available --- openvidu-browser/src/OpenVidu/Stream.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openvidu-browser/src/OpenVidu/Stream.ts b/openvidu-browser/src/OpenVidu/Stream.ts index cece1ecf..42e6ee70 100644 --- a/openvidu-browser/src/OpenVidu/Stream.ts +++ b/openvidu-browser/src/OpenVidu/Stream.ts @@ -478,11 +478,12 @@ export class Stream { * @hidden */ disposeWebRtcPeer(): void { - const webrtcId: string = this.webRtcPeer.id; + let webrtcId; if (!!this.webRtcPeer) { this.webRtcPeer.dispose(); - this.stopWebRtcStats(); + webrtcId = this.webRtcPeer.id; } + this.stopWebRtcStats(); logger.info((!!this.outboundStreamOpts ? 'Outbound ' : 'Inbound ') + "RTCPeerConnection with id [" + webrtcId + "] from 'Stream' with id [" + this.streamId + '] is now closed'); }