From 46d5ebb2f4b238b327f564fbc6d02ab95237f86c Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Tue, 12 Sep 2017 10:21:02 -0400 Subject: [PATCH] Only reset settings if the file is empty --- src/config.coffee | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/config.coffee b/src/config.coffee index 2f0952e8a..c7eea02c4 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -872,6 +872,11 @@ class Config try unless @savePending userConfig = CSON.readFileSync(@configFilePath) + userConfig = {} if userConfig is null + + unless isPlainObject(userConfig) + throw new Error("`#{path.basename(@configFilePath)}` must contain valid JSON or CSON") + @resetUserSettings(userConfig) @configFileHasErrors = false catch error @@ -930,11 +935,6 @@ class Config ### resetUserSettings: (newSettings) -> - unless isPlainObject(newSettings) - @settings = {} - @emitChangeEvent() - return - if newSettings.global? newSettings['*'] = newSettings.global delete newSettings.global