mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-30 16:32:50 -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);
|
Store.parse(root, obj);
|
||||||
|
|
||||||
if (obj.weatherLocation !== undefined)
|
if (obj?.weatherLocation !== undefined)
|
||||||
_legacyWeatherLocation = obj.weatherLocation;
|
_legacyWeatherLocation = obj.weatherLocation;
|
||||||
if (obj.weatherCoordinates !== undefined)
|
if (obj?.weatherCoordinates !== undefined)
|
||||||
_legacyWeatherCoordinates = obj.weatherCoordinates;
|
_legacyWeatherCoordinates = obj.weatherCoordinates;
|
||||||
|
|
||||||
_loadedSettingsSnapshot = JSON.stringify(Store.toJson(root));
|
_loadedSettingsSnapshot = JSON.stringify(Store.toJson(root));
|
||||||
|
|||||||
@@ -4,12 +4,15 @@
|
|||||||
|
|
||||||
function parse(root, jsonObj) {
|
function parse(root, jsonObj) {
|
||||||
var SPEC = SpecModule.SPEC;
|
var SPEC = SpecModule.SPEC;
|
||||||
for (var k in SPEC) {
|
|
||||||
root[k] = SPEC[k].def;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!jsonObj) return;
|
if (!jsonObj) return;
|
||||||
|
|
||||||
|
for (var k in SPEC) {
|
||||||
|
if (!(k in jsonObj)) {
|
||||||
|
root[k] = SPEC[k].def;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (var k in jsonObj) {
|
for (var k in jsonObj) {
|
||||||
if (!SPEC[k]) continue;
|
if (!SPEC[k]) continue;
|
||||||
var raw = jsonObj[k];
|
var raw = jsonObj[k];
|
||||||
|
|||||||
@@ -4,14 +4,16 @@
|
|||||||
|
|
||||||
function parse(root, jsonObj) {
|
function parse(root, jsonObj) {
|
||||||
var SPEC = SpecModule.SPEC;
|
var SPEC = SpecModule.SPEC;
|
||||||
for (var k in SPEC) {
|
|
||||||
if (k === "pluginSettings") continue;
|
|
||||||
var spec = SPEC[k];
|
|
||||||
root[k] = spec.def;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!jsonObj) return;
|
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) {
|
for (var k in jsonObj) {
|
||||||
if (!SPEC[k]) continue;
|
if (!SPEC[k]) continue;
|
||||||
if (k === "pluginSettings") continue;
|
if (k === "pluginSettings") continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user