Skip to content

Commit

Permalink
Fix thamara#258: Fixing crash when changing network while opening TTL
Browse files Browse the repository at this point in the history
  • Loading branch information
araujoarthur0 committed Jun 19, 2020
1 parent e9db00c commit 62f9154
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ var launchDate = new Date();
var recommendPunchIn = false;
setTimeout(() => { recommendPunchIn = true; }, 30 * 60 * 1000);

process.on('uncaughtException', function(err) {
if (!err.message.includes('net::ERR_NETWORK_CHANGED')) {
console.error((new Date).toUTCString() + ' uncaughtException:', err.message);
console.error(err.stack);
process.exit(1);
}
});

function checkIdleAndNotify() {
if (recommendPunchIn) {
recommendPunchIn = false;
Expand Down Expand Up @@ -130,7 +138,7 @@ function createWindow() {
const today = new Date();
global.waiverDay = getDateStr(today);
}
const htmlPath = path.join('file://', __dirname, 'src/workday-waiver.html');
const htmlPath = path.join(__dirname, 'src/workday-waiver.html');
waiverWindow = new BrowserWindow({ width: 600,
height: 500,
parent: win,
Expand All @@ -141,7 +149,7 @@ function createWindow() {
nodeIntegration: true
} });
waiverWindow.setMenu(null);
waiverWindow.loadURL(htmlPath);
waiverWindow.loadFile(htmlPath);
waiverWindow.show();
waiverWindow.on('close', function() {
waiverWindow = null;
Expand Down Expand Up @@ -192,7 +200,7 @@ function createWindow() {
return;
}

const htmlPath = path.join('file://', __dirname, 'src/preferences.html');
const htmlPath = path.join(__dirname, 'src/preferences.html');
prefWindow = new BrowserWindow({ width: 400,
height: 500,
parent: win,
Expand All @@ -203,7 +211,7 @@ function createWindow() {
nodeIntegration: true
} });
prefWindow.setMenu(null);
prefWindow.loadURL(htmlPath);
prefWindow.loadFile(htmlPath);
prefWindow.show();
//prefWindow.webContents.openDevTools()
prefWindow.on('close', function() {
Expand Down

0 comments on commit 62f9154

Please sign in to comment.