weather: Fix crash when weather.json is absent

pull/839/head
Ben Whittaker 2021-10-04 09:23:12 -04:00
parent a2c400780d
commit 46ccfe86e3
3 changed files with 4 additions and 3 deletions

View File

@ -585,7 +585,7 @@
{ "id": "weather", { "id": "weather",
"name": "Weather", "name": "Weather",
"icon": "icon.png", "icon": "icon.png",
"version":"0.08", "version":"0.09",
"description": "Show Gadgetbridge weather report", "description": "Show Gadgetbridge weather report",
"readme": "readme.md", "readme": "readme.md",
"tags": "widget,outdoors", "tags": "widget,outdoors",

View File

@ -5,3 +5,4 @@
0.06: Use setUI for launcher. 0.06: Use setUI for launcher.
0.07: Add theme support and unknown icon. 0.07: Add theme support and unknown icon.
0.08: Refactor and reduce widget ram usage. 0.08: Refactor and reduce widget ram usage.
0.09: Fix crash when weather.json is absent.

View File

@ -47,7 +47,7 @@ global.GB = (event) => {
}; };
exports.get = function() { exports.get = function() {
return storage.readJSON('weather.json').weather; return (storage.readJSON('weather.json')||{}).weather;
} }
scheduleExpiry(storage.readJSON('weather.json')||{}); scheduleExpiry(storage.readJSON('weather.json')||{});