1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Handle blank config file

This commit is contained in:
Nick O'Leary 2014-09-22 21:35:30 +01:00
parent 1f95071a37
commit 31255bd66b

View File

@ -215,7 +215,11 @@ var localfilesystem = {
getSettings: function() { getSettings: function() {
if (fs.existsSync(globalSettingsFile)) { if (fs.existsSync(globalSettingsFile)) {
return nodeFn.call(fs.readFile,globalSettingsFile,'utf8').then(function(data) { return nodeFn.call(fs.readFile,globalSettingsFile,'utf8').then(function(data) {
return JSON.parse(data); if (data) {
return JSON.parse(data);
} else {
return {};
}
}); });
} }
return when.resolve({}); return when.resolve({});