Skip to content

Commit

Permalink
Handle invalid configuration (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Jun 28, 2019
1 parent cafd90b commit 6a10ecf
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -799,21 +799,22 @@ class ViewCollection {
class ConfigurationService {

load() {
this._data = { 'recents': [] };
var dir = electron.app.getPath('userData');
if (dir && dir.length > 0) {
var file = path.join(dir, 'configuration.json');
if (fs.existsSync(file)) {
var data = fs.readFileSync(file);
if (data) {
this._data = JSON.parse(data);
try {
this._data = JSON.parse(data);
}
catch (error) {
// continue regardless of error
}
}
}
}
if (!this._data) {
this._data = {
'recents': []
};
}
}

save() {
Expand Down

0 comments on commit 6a10ecf

Please sign in to comment.