Fix call crashing because element was undefined

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
pull/21833/head
Šimon Brandner 2021-07-27 18:05:50 +02:00
parent 3e7aee3a87
commit 36607fa8a2
No known key found for this signature in database
GPG Key ID: 55C211A1226CB17D
1 changed files with 4 additions and 1 deletions

View File

@ -80,7 +80,10 @@ export default class VideoFeed extends React.Component<IProps, IState> {
}
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);