Skip to content

Commit

Permalink
alwaysontop/renderer(fix): Prevent crash when handling new browser wi…
Browse files Browse the repository at this point in the history
…ndow
  • Loading branch information
horymury authored and hristoterezov committed Apr 24, 2020
1 parent fd05a9b commit 42ae5f5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions alwaysontop/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ class AlwaysOnTop extends EventEmitter {
*/
_onNewAlwaysOnTopBrowserWindow(windowId) {
this._alwaysOnTopBrowserWindow = remote.BrowserWindow.fromId(windowId);
if (!this._alwaysOnTopBrowserWindow || this._alwaysOnTopBrowserWindow.isDestroyed()){
return;
}

const { webContents } = this._alwaysOnTopBrowserWindow;
// if the window is still loading we may end up loosing the injected content when load finishes. We need to wait
// for the loading to be completed. We are using the browser windows events instead of the DOM window ones because
Expand Down

0 comments on commit 42ae5f5

Please sign in to comment.