diff --git a/bigbluebutton-html5/imports/ui/components/video-provider/component.jsx b/bigbluebutton-html5/imports/ui/components/video-provider/component.jsx index 5d2679f963..e7d5783006 100755 --- a/bigbluebutton-html5/imports/ui/components/video-provider/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/video-provider/component.jsx @@ -226,9 +226,11 @@ class VideoProvider extends Component { this._isMounted = false; VideoService.updatePeerDictionaryReference({}); - this.ws.onmessage = null; - this.ws.onopen = null; - this.ws.onclose = null; + if (this.ws) { + this.ws.onmessage = null; + this.ws.onopen = null; + this.ws.onclose = null; + } window.removeEventListener('beforeunload', this.onBeforeUnload); VideoService.exitVideo(sendUserUnshareWebcam); diff --git a/bigbluebutton-html5/imports/ui/components/video-provider/video-provider-graphql/component.tsx b/bigbluebutton-html5/imports/ui/components/video-provider/video-provider-graphql/component.tsx index eeae30c387..9108d528c4 100755 --- a/bigbluebutton-html5/imports/ui/components/video-provider/video-provider-graphql/component.tsx +++ b/bigbluebutton-html5/imports/ui/components/video-provider/video-provider-graphql/component.tsx @@ -229,9 +229,11 @@ class VideoProviderGraphql extends Component { this._isMounted = false; VideoService.updatePeerDictionaryReference({}); - this.ws.onmessage = null; - this.ws.onopen = null; - this.ws.onclose = null; + if (this.ws) { + this.ws.onmessage = null; + this.ws.onopen = null; + this.ws.onclose = null; + } window.removeEventListener('beforeunload', this.onBeforeUnload); exitVideo();