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);