Set default if a configuration element is missing (#92)

This commit is contained in:
nobody 2020-09-08 20:49:10 +02:00
parent 6a80106def
commit e2536dff2e
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
1 changed files with 3 additions and 0 deletions

View File

@ -144,6 +144,9 @@ storageManager._validation = function (content) {
} else if (typeof value === 'boolean' || value instanceof Boolean) { } else if (typeof value === 'boolean' || value instanceof Boolean) {
imported[key] = content[key]; imported[key] = content[key];
} }
} else if (content[key] === undefined) {
// Set default if not existing in file
imported[key] = value;
} else { } else {
alert(chrome.i18n.getMessage('dialogImportFailed')); alert(chrome.i18n.getMessage('dialogImportFailed'));
throw 'Invalid file!'; throw 'Invalid file!';