Merge pull request #3226 from bobrippling/fix/multitimer-settings

multitimer: fix settings
master
thyttan 2024-03-02 16:46:08 +01:00 committed by GitHub
commit 4c0eccaf67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -1,10 +1,11 @@
(function(back) {
const file = "multitimer.json";
let json = require('Storage').readJSON(file, true);
let json = require('Storage').readJSON(file, true) || {};
if (Array.isArray(json)) {
// old format, convert
json = { sw: json };
}
if (!json.sw) json.sw = [];
function writeSettings() {
require('Storage').writeJSON(file, json);