From 56ea00dc3159bc77ae108f03b7df11b9c2a295e7 Mon Sep 17 00:00:00 2001 From: Weiming Hu Date: Mon, 13 Sep 2021 10:55:33 -0400 Subject: [PATCH] fix file-not-found issue during the first boot --- apps/hourstrike/ChangeLog | 2 +- apps/hourstrike/boot.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/hourstrike/ChangeLog b/apps/hourstrike/ChangeLog index 15a8b9a35..d0b064565 100644 --- a/apps/hourstrike/ChangeLog +++ b/apps/hourstrike/ChangeLog @@ -5,4 +5,4 @@ 0.05: Add display for the next strike time 0.06: Move the next strike time to the first row of display 0.07: Change the boot function to avoid reloading the entire watch -0.08: Default to no strikes. +0.08: Default to no strikes. Fix file-not-found issue during the first boot. diff --git a/apps/hourstrike/boot.js b/apps/hourstrike/boot.js index 8ddad31af..0c71f03a6 100644 --- a/apps/hourstrike/boot.js +++ b/apps/hourstrike/boot.js @@ -1,6 +1,7 @@ (function() { function setup () { var settings = require('Storage').readJSON('hourstrike.json',1)||[]; + if (!settings) resetSettings(); var t = new Date(); var t_min_sec = t.getMinutes()*60+t.getSeconds(); var wait_msec = settings.interval>0?(settings.interval-t_min_sec%settings.interval)*1000:-1;