Skip to content

Commit

Permalink
Don't crash on OSX is the settings window is closed.
Browse files Browse the repository at this point in the history
Check window exists before sending js function.
  • Loading branch information
stevecat committed Apr 27, 2016
1 parent 3fdb736 commit 37136b5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions main.js
Expand Up @@ -290,9 +290,7 @@ function updateCatFaces() {
// Update global for mainWindow
global.catnap.catInUse=image;

if (mainWindow!==null) {
mainWindow.webContents.executeJavaScript('updateClockText()');
}
if (mainWindow) mainWindow.webContents.executeJavaScript('updateClockText()');

}

Expand Down Expand Up @@ -438,7 +436,7 @@ function brkTime() {
if (brkProcess) { clearInterval(brkProcess); }
brkProcess = setInterval(brkInterval, 1000); // 1000. Shorten for debugging.

mainWindow.webContents.executeJavaScript('updateClockText()');
if (mainWindow) mainWindow.webContents.executeJavaScript('updateClockText()');
updateTooltip();

}
Expand Down

0 comments on commit 37136b5

Please sign in to comment.