Basic 'no file' error catching

This commit is contained in:
Enrico Monese 2017-03-28 18:19:39 +02:00
parent a0ca1238f3
commit 956b105128
1 changed files with 6 additions and 1 deletions

View File

@ -110,7 +110,12 @@ function setAppOptions() {
}
function createMainWindow() {
const titlebarStyle = JSON.parse(fs.readFileSync(appSettingsFileName, 'utf8')).titlebarStyle;
let titlebarStyle = 'default'; // predefined value may not be needed
try {
titlebarStyle = JSON.parse(fs.readFileSync(appSettingsFileName, 'utf8')).titlebarStyle;
} catch (e) {
if (e.code !== 'ENOENT') throw err;
}
mainWindow = new electron.BrowserWindow({
show: false,
width: 1000, height: 700, minWidth: 700, minHeight: 400,