(Fix) Prevent accessing `contentWindow` if `iframe` is `null` (#1161)

This commit is contained in:
Fernando 2020-07-24 17:46:11 -03:00 committed by GitHub
parent 0b25094b95
commit fc20ce5775
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -226,9 +226,9 @@ function Apps({ closeModal, closeSnackbar, enqueueSnackbar, openModal }) {
const sendMessageToIframe = useCallback(
(messageId, data) => {
const app = getSelectedApp()
iframeEl.contentWindow.postMessage({ messageId, data }, app.url)
iframeEl?.contentWindow.postMessage({ messageId, data }, app.url)
},
[getSelectedApp, iframeEl.contentWindow],
[getSelectedApp, iframeEl],
)
// handle messages from iframe