From 3ba2fa42dce145224484ea41cf60ab3d56f9d680 Mon Sep 17 00:00:00 2001 From: Egor Didenko Date: Thu, 12 Dec 2024 09:42:41 -0500 Subject: [PATCH] fix(camera-tab): added check removeEventListener --- blocks/CameraSource/CameraSource.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blocks/CameraSource/CameraSource.js b/blocks/CameraSource/CameraSource.js index d35f6be7..98c45789 100644 --- a/blocks/CameraSource/CameraSource.js +++ b/blocks/CameraSource/CameraSource.js @@ -797,10 +797,10 @@ export class CameraSource extends UploaderBlock { _destroy() { for (const permission of DEFAULT_PERMISSIONS) { - this[`${permission}Response`].removeEventListener('change', this._handlePermissionsChange); + this[`${permission}Response`]?.removeEventListener('change', this._handlePermissionsChange); } - navigator.mediaDevices.removeEventListener('devicechange', this._getDevices); + navigator.mediaDevices?.removeEventListener('devicechange', this._getDevices); } async destroyCallback() {