openvidu-browser: fix disposeWebRtcPeer exception when no WebRtcPeer is available

pull/630/head
pabloFuente 2021-06-09 15:14:25 +02:00
parent 8e07cfd3d5
commit 2fcf136fa3
1 changed files with 3 additions and 2 deletions

View File

@ -478,11 +478,12 @@ export class Stream {
* @hidden * @hidden
*/ */
disposeWebRtcPeer(): void { disposeWebRtcPeer(): void {
const webrtcId: string = this.webRtcPeer.id; let webrtcId;
if (!!this.webRtcPeer) { if (!!this.webRtcPeer) {
this.webRtcPeer.dispose(); 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'); logger.info((!!this.outboundStreamOpts ? 'Outbound ' : 'Inbound ') + "RTCPeerConnection with id [" + webrtcId + "] from 'Stream' with id [" + this.streamId + '] is now closed');
} }