fix(hangup): truthy check for deviceChangeListener before removing it (#3235)

It can be that deviceChangeListener is never defined because
the isDeviceList call never completes. On hangup, that would
cause an error to be thrown within lib-jitsi-meet because of
an attempt to remove an undefined event handler. That is
what happens on Safari right now.
This commit is contained in:
virtuacoplenny 2018-07-09 11:46:26 -07:00 committed by GitHub
parent d12afc5c07
commit 485ff81443
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -2479,9 +2479,11 @@ export default {
APP.UI.removeLocalMedia(); APP.UI.removeLocalMedia();
// Remove unnecessary event listeners from firing callbacks. // Remove unnecessary event listeners from firing callbacks.
JitsiMeetJS.mediaDevices.removeEventListener( if (this.deviceChangeListener) {
JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED, JitsiMeetJS.mediaDevices.removeEventListener(
this.deviceChangeListener); JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED,
this.deviceChangeListener);
}
let requestFeedbackPromise; let requestFeedbackPromise;