From 31255bd66b85deb962c9ee6a35586d04581c5086 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 22 Sep 2014 21:35:30 +0100 Subject: [PATCH] Handle blank config file --- red/storage/localfilesystem.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/red/storage/localfilesystem.js b/red/storage/localfilesystem.js index 925449699..fce9a9034 100644 --- a/red/storage/localfilesystem.js +++ b/red/storage/localfilesystem.js @@ -215,7 +215,11 @@ var localfilesystem = { getSettings: function() { if (fs.existsSync(globalSettingsFile)) { 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({});