fix: improve Guard for Iframe resize (#875)

Fix line that was causing JS errors when it was called in a context without a valid document.
This commit is contained in:
Chris Deery
2022-03-17 14:47:19 -04:00
committed by GitHub
parent d03dd34009
commit 9436770620

View File

@@ -28,7 +28,7 @@ export default function LmsHtmlFragment({
const iframe = useRef(null);
function resetIframeHeight() {
if (iframe.current) {
if (iframe?.current?.contentWindow?.document?.body) {
iframe.current.height = iframe.current.contentWindow.document.body.scrollHeight;
}
}