1
0
Fork 0
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:
Michael Hollister 2025-06-23 17:30:47 -05:00
parent 3cab714b71
commit c4c2c903da

View file

@ -43,7 +43,15 @@ export class Settings {
// @ts-ignore
if (TARGET === 'electron') {
Settings.path = path;
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();