diff --git a/bigbluebutton-html5/imports/ui/components/video-provider/component.jsx b/bigbluebutton-html5/imports/ui/components/video-provider/component.jsx
index cf507eabe0..75bae3de66 100755
--- a/bigbluebutton-html5/imports/ui/components/video-provider/component.jsx
+++ b/bigbluebutton-html5/imports/ui/components/video-provider/component.jsx
@@ -220,9 +220,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', VideoProvider.onBeforeUnload);
VideoService.exitVideo();