From 36607fa8a241538981af317a5283c569da20b77e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Tue, 27 Jul 2021 18:05:50 +0200 Subject: [PATCH] Fix call crashing because element was undefined MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/components/views/voip/VideoFeed.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/views/voip/VideoFeed.tsx b/src/components/views/voip/VideoFeed.tsx index 397d11bfcae..51d2adb8455 100644 --- a/src/components/views/voip/VideoFeed.tsx +++ b/src/components/views/voip/VideoFeed.tsx @@ -80,7 +80,10 @@ export default class VideoFeed extends React.Component { } private setElementRef = (element: HTMLVideoElement): void => { - if (!element) element.removeEventListener('resize', this.onResize); + if (!element) { + this.element?.removeEventListener('resize', this.onResize); + return; + } this.element = element; element.addEventListener('resize', this.onResize);