Merge pull request #20159 from prlanzarin/u30/fix/onconnectionstatechange-crash-rc

fix(bbb-html5): crash when stopping WebRTC peers
This commit is contained in:
Anton Georgiev 2024-05-03 08:52:28 -04:00 committed by GitHub
commit 70e4ab1f66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -283,7 +283,9 @@ class BaseBroker {
}
if (connectionState === 'failed' || connectionState === 'closed') {
this.webRtcPeer.peerConnection.onconnectionstatechange = null;
if (this.webRtcPeer?.peerConnection) {
this.webRtcPeer.peerConnection.onconnectionstatechange = null;
}
// 1307: "ICE_STATE_FAILED",
const error = BaseBroker.assembleError(1307);
this.onerror(error);
@ -343,7 +345,7 @@ class BaseBroker {
this.onerror = function(){};
window.removeEventListener('beforeunload', this.onbeforeunload);
if (this.webRtcPeer) {
if (this.webRtcPeer?.peerConnection) {
this.webRtcPeer.peerConnection.onconnectionstatechange = null;
}