diff --git a/apps/sleeplog/ChangeLog b/apps/sleeplog/ChangeLog index 5560f00bc..7dee1a116 100644 --- a/apps/sleeplog/ChangeLog +++ b/apps/sleeplog/ChangeLog @@ -1 +1,2 @@ 0.01: New App! +0.02: Fix crash on start diff --git a/apps/sleeplog/boot.js b/apps/sleeplog/boot.js index 7ec71742c..883e497a5 100644 --- a/apps/sleeplog/boot.js +++ b/apps/sleeplog/boot.js @@ -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 && diff --git a/apps/sleeplog/metadata.json b/apps/sleeplog/metadata.json index 4a67af301..f4590f7c0 100644 --- a/apps/sleeplog/metadata.json +++ b/apps/sleeplog/metadata.json @@ -2,7 +2,7 @@ "id":"sleeplog", "name":"Sleep Log", "shortName": "SleepLog", - "version": "0.01", + "version": "0.02", "description": "Log and view your sleeping habits. This app derived from SleepPhaseAlarm and uses also the principe of Estimation of Stationary Sleep-segments (ESS).", "icon": "app.png", "type": "app",