mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
settings: prevent overwrites if parse called with null object
This commit is contained in:
@@ -798,9 +798,9 @@ Singleton {
|
||||
|
||||
Store.parse(root, obj);
|
||||
|
||||
if (obj.weatherLocation !== undefined)
|
||||
if (obj?.weatherLocation !== undefined)
|
||||
_legacyWeatherLocation = obj.weatherLocation;
|
||||
if (obj.weatherCoordinates !== undefined)
|
||||
if (obj?.weatherCoordinates !== undefined)
|
||||
_legacyWeatherCoordinates = obj.weatherCoordinates;
|
||||
|
||||
_loadedSettingsSnapshot = JSON.stringify(Store.toJson(root));
|
||||
|
||||
@@ -4,12 +4,15 @@
|
||||
|
||||
function parse(root, jsonObj) {
|
||||
var SPEC = SpecModule.SPEC;
|
||||
for (var k in SPEC) {
|
||||
root[k] = SPEC[k].def;
|
||||
}
|
||||
|
||||
if (!jsonObj) return;
|
||||
|
||||
for (var k in SPEC) {
|
||||
if (!(k in jsonObj)) {
|
||||
root[k] = SPEC[k].def;
|
||||
}
|
||||
}
|
||||
|
||||
for (var k in jsonObj) {
|
||||
if (!SPEC[k]) continue;
|
||||
var raw = jsonObj[k];
|
||||
|
||||
@@ -4,14 +4,16 @@
|
||||
|
||||
function parse(root, jsonObj) {
|
||||
var SPEC = SpecModule.SPEC;
|
||||
for (var k in SPEC) {
|
||||
if (k === "pluginSettings") continue;
|
||||
var spec = SPEC[k];
|
||||
root[k] = spec.def;
|
||||
}
|
||||
|
||||
if (!jsonObj) return;
|
||||
|
||||
for (var k in SPEC) {
|
||||
if (k === "pluginSettings") continue;
|
||||
if (!(k in jsonObj)) {
|
||||
root[k] = SPEC[k].def;
|
||||
}
|
||||
}
|
||||
|
||||
for (var k in jsonObj) {
|
||||
if (!SPEC[k]) continue;
|
||||
if (k === "pluginSettings") continue;
|
||||
|
||||
Reference in New Issue
Block a user