From 46ccfe86e352d9f4a3464b0a7bd2d587224e6d5f Mon Sep 17 00:00:00 2001 From: Ben Whittaker Date: Mon, 4 Oct 2021 09:23:12 -0400 Subject: [PATCH] weather: Fix crash when weather.json is absent --- apps.json | 2 +- apps/weather/ChangeLog | 3 ++- apps/weather/lib.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps.json b/apps.json index 10b37e5b1..83690cf3e 100644 --- a/apps.json +++ b/apps.json @@ -585,7 +585,7 @@ { "id": "weather", "name": "Weather", "icon": "icon.png", - "version":"0.08", + "version":"0.09", "description": "Show Gadgetbridge weather report", "readme": "readme.md", "tags": "widget,outdoors", diff --git a/apps/weather/ChangeLog b/apps/weather/ChangeLog index fd5d4d146..09e159045 100644 --- a/apps/weather/ChangeLog +++ b/apps/weather/ChangeLog @@ -4,4 +4,5 @@ 0.05: Add wind direction. 0.06: Use setUI for launcher. 0.07: Add theme support and unknown icon. -0.08: Refactor and reduce widget ram usage. \ No newline at end of file +0.08: Refactor and reduce widget ram usage. +0.09: Fix crash when weather.json is absent. \ No newline at end of file diff --git a/apps/weather/lib.js b/apps/weather/lib.js index f08df4a4a..299009e74 100644 --- a/apps/weather/lib.js +++ b/apps/weather/lib.js @@ -47,7 +47,7 @@ global.GB = (event) => { }; exports.get = function() { - return storage.readJSON('weather.json').weather; + return (storage.readJSON('weather.json')||{}).weather; } scheduleExpiry(storage.readJSON('weather.json')||{});