Addressed undefined weather timestamp

pull/2569/head
Sam Sorensen 2023-02-08 22:37:39 -07:00
parent cb8e733738
commit 6439062d92
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",