From 38202c147273d581c342c0b49e0c5e38d24d817d Mon Sep 17 00:00:00 2001 From: Rishabh Date: Thu, 24 Jun 2021 21:47:31 +0530 Subject: [PATCH] Added guard for missing contentDocument no refs - in a rare edge case, its possible that `contentDocument` is not available due to component unmount, guards against erroring in such scenarios --- ghost/portal/src/components/Frame.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ghost/portal/src/components/Frame.js b/ghost/portal/src/components/Frame.js index 0813e8a979..3f76de9a21 100644 --- a/ghost/portal/src/components/Frame.js +++ b/ghost/portal/src/components/Frame.js @@ -15,10 +15,12 @@ export default class Frame extends Component { } setupFrameBaseStyle() { - this.iframeHtml = this.node.contentDocument.documentElement; - this.iframeHead = this.node.contentDocument.head; - this.iframeRoot = this.node.contentDocument.body; - this.forceUpdate(); + if (this.node.contentDocument) { + this.iframeHtml = this.node.contentDocument.documentElement; + this.iframeHead = this.node.contentDocument.head; + this.iframeRoot = this.node.contentDocument.body; + this.forceUpdate(); + } } render() {