1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-25 05:52:50 -05:00

settings: prevent overwrites if parse called with null object

This commit is contained in:
bbedward
2026-01-02 15:45:31 -05:00
parent 3e1c6534bd
commit 6cff5f1146
3 changed files with 15 additions and 10 deletions

View File

@@ -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));

View File

@@ -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];

View File

@@ -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;