From 09e1040cd149bad4736cf2f78dfaf54e773ec659 Mon Sep 17 00:00:00 2001 From: TSO Date: Mon, 8 Jan 2024 15:16:57 +0100 Subject: [PATCH] [FIX] discuss: prevent peer-to-peer update without a `RTCPeerConnection` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, it was possible that an attempt to update peer connections made right at the moment the connection was swapped from peer-to-peer to server mode. Which would cause a traceback. This commit fixes this issue by checking if there is a `RTCPeerConnection` before trying to update it. closes odoo/odoo#148505 Signed-off-by: Sébastien Theys (seb) --- addons/mail/static/src/discuss/call/common/rtc_service.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/mail/static/src/discuss/call/common/rtc_service.js b/addons/mail/static/src/discuss/call/common/rtc_service.js index 3196c3cd627..033ce1b9404 100644 --- a/addons/mail/static/src/discuss/call/common/rtc_service.js +++ b/addons/mail/static/src/discuss/call/common/rtc_service.js @@ -1494,6 +1494,9 @@ export class Rtc { * negotiationneeded -> offer -> answer -> ... */ async updateRemote(session, trackKind) { + if (!session.peerConnection) { + return; + } this.log(session, `updating ${trackKind} transceiver`); let track; switch (trackKind) {