mirror of
https://gitlab.com/futo-org/fcast.git
synced 2025-06-24 21:25:23 +00:00
Receivers: Fixed crash on reading invalid settings file
This commit is contained in:
parent
3cab714b71
commit
c4c2c903da
1 changed files with 9 additions and 1 deletions
|
@ -43,7 +43,15 @@ export class Settings {
|
|||
// @ts-ignore
|
||||
if (TARGET === 'electron') {
|
||||
Settings.path = path;
|
||||
Settings.json = JSON.parse(fs.readFileSync(path, { encoding: 'utf8', flag: 'r' })) as Settings;
|
||||
|
||||
try {
|
||||
Settings.json = JSON.parse(fs.readFileSync(path, { encoding: 'utf8', flag: 'r' })) as Settings;
|
||||
}
|
||||
catch (err) {
|
||||
logger.error('Error reading settings JSON file, resetting to default settings.\n', err);
|
||||
Settings.json = {} as Settings;
|
||||
}
|
||||
|
||||
logger.info('Read settings file:', Settings.json);
|
||||
Settings.setDefault();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue