diff --git a/addons/mail/static/src/models/rtc/rtc.js b/addons/mail/static/src/models/rtc/rtc.js index e9167f56d7d..2a10cde271f 100644 --- a/addons/mail/static/src/models/rtc/rtc.js +++ b/addons/mail/static/src/models/rtc/rtc.js @@ -772,9 +772,12 @@ function factory(dependencies) { if (rtcSession) { rtcSession.reset(); } - const peerConnection = this._peerConnections[token]; const dataChannel = this._dataChannels[token]; - dataChannel.close(); + if (dataChannel) { + dataChannel.close(); + } + delete this._dataChannels[token]; + const peerConnection = this._peerConnections[token]; if (peerConnection) { this._removeRemoteTracks(peerConnection); peerConnection.close();