Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #9462 from brave/web-contents-send
Browse files Browse the repository at this point in the history
check for destroyed before sending to webContents
  • Loading branch information
bbondy committed Jun 15, 2017
1 parent e0c1572 commit a42dc39
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions js/stores/appStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,11 @@ class AppStore extends EventEmitter {
if (lastEmittedState) {
const d = diff(lastEmittedState, appState)
if (!d.isEmpty()) {
BrowserWindow.getAllWindows().forEach((wnd) =>
wnd.webContents.send(messages.APP_STATE_CHANGE, { stateDiff: d.toJS() }))
BrowserWindow.getAllWindows().forEach((wnd) => {
if (wnd.webContents && !wnd.webContents.isDestroyed()) {
wnd.webContents.send(messages.APP_STATE_CHANGE, { stateDiff: d.toJS() })
}
})
lastEmittedState = appState
this.emit(CHANGE_EVENT, d.toJS())
}
Expand Down

0 comments on commit a42dc39

Please sign in to comment.