fixes oopts if empty

This commit is contained in:
Matias Alejo Garcia 2016-06-09 19:00:09 -03:00
commit 268702dec0
No known key found for this signature in database
GPG key ID: 02470DB551277AB3

View file

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