From 1783f91ef72c8faf85253ffc8beb8ab894c7de1b Mon Sep 17 00:00:00 2001 From: vip30 Date: Mon, 17 Jul 2023 16:59:43 +0800 Subject: [PATCH] fix: add null check in iframe --- packages/react-youtube/src/YouTube.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-youtube/src/YouTube.tsx b/packages/react-youtube/src/YouTube.tsx index 55135a7..a4efb03 100644 --- a/packages/react-youtube/src/YouTube.tsx +++ b/packages/react-youtube/src/YouTube.tsx @@ -364,6 +364,7 @@ class YouTube extends React.Component { */ updatePlayer = () => { this.internalPlayer?.getIframe().then((iframe) => { + if (!iframe) return; if (this.props.id) iframe.setAttribute('id', this.props.id); else iframe.removeAttribute('id'); if (this.props.iframeClassName) iframe.setAttribute('class', this.props.iframeClassName);