mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Fix race condition on saving config
This commit is contained in:
@@ -216,7 +216,12 @@ var localfilesystem = {
|
||||
if (fs.existsSync(globalSettingsFile)) {
|
||||
return nodeFn.call(fs.readFile,globalSettingsFile,'utf8').then(function(data) {
|
||||
if (data) {
|
||||
return JSON.parse(data);
|
||||
try {
|
||||
return JSON.parse(data);
|
||||
} catch(err) {
|
||||
util.log("[red] Corrupted config detected - resetting");
|
||||
return {};
|
||||
}
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
|
Reference in New Issue
Block a user