Merge pull request #4342 from matiu/bug/empty-config

fixes opts if empty
This commit is contained in:
Gustavo Maximiliano Cortez 2016-06-09 19:15:01 -03:00 committed by GitHub
commit 1ebe7f95d2
1 changed files with 3 additions and 0 deletions

View File

@ -125,6 +125,8 @@ angular.module('copayApp.services').factory('configService', function(storageSer
root.set = function(newOpts, cb) {
var config = lodash.cloneDeep(defaultConfig);
storageService.getConfig(function(err, oldOpts) {
oldOpts = oldOpts || {};
if (lodash.isString(oldOpts)) {
oldOpts = JSON.parse(oldOpts);
}
@ -134,6 +136,7 @@ angular.module('copayApp.services').factory('configService', function(storageSer
if (lodash.isString(newOpts)) {
newOpts = JSON.parse(newOpts);
}
lodash.merge(config, oldOpts, newOpts);
configCache = config;