mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #4342 from matiu/bug/empty-config
fixes opts if empty
This commit is contained in:
commit
1ebe7f95d2
|
@ -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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue