Merge pull request #2569 from sabrsorensen/mtnclock_fix_unexpected_undefined_in_readWeather

[mtnclock] Addressed undefined weather timestamp
master
Gordon Williams 2023-02-09 09:25:43 +00:00 committed by GitHub
commit 2d0c88f0af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

View File

@ -1,2 +1,3 @@
0.01: New App!
0.02: Get weather from weather.json
0.03: Address unexpected undefined when reading weather.json

View File

@ -326,7 +326,7 @@ function setWeather() {
function readWeather() {
var weatherJson = require("Storage").readJSON('weather.json', 1);
// save updated weather data if available and it has been an hour since last updated
if (weatherJson !== undefined && (data.time === undefined || (data.time + 3600000) < weatherJson.weather.time)) {
if (weatherJson && weatherJson.weather && weatherJson.weather.time && (data.time === undefined || (data.time + 3600000) < weatherJson.weather.time)) {
data = {
time: weatherJson.weather.time,
temp: weatherJson.weather.temp,

View File

@ -2,7 +2,7 @@
"id": "mtnclock",
"name": "Mountain Pass Clock",
"shortName": "Mtn Clock",
"version": "0.02",
"version": "0.03",
"description": "A clock that changes scenery based on time and weather.",
"readme":"README.md",
"icon": "app.png",