Update boot.js

Fixes Uncaught Error: Expecting a string, got undefined
see https://github.com/espruino/BangleApps/issues/1423
master
Marco H 2022-02-11 13:16:59 +01:00 committed by GitHub
parent 615519350a
commit 50b94d6870
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -90,7 +90,10 @@ if (global.sleeplog.enabled) {
var storage = require("Storage");
// read previous logfile
var log = JSON.parse(atob(storage.read(this.logfile)));
var logContent = storage.read(this.logfile) || "";
// parse previous logfile
var log = JSON.parse(logContent.length > 0 ? atob(logContent) : "[]") ;
// remove last state if it was unknown and is less then 10min ago
if (log.length > 0 && log[0][1] === 0 &&