From 6439062d922cea0fdedcecef3a6480c4ea3ff652 Mon Sep 17 00:00:00 2001 From: Sam Sorensen <825813+sabrsorensen@users.noreply.github.com> Date: Wed, 8 Feb 2023 22:37:39 -0700 Subject: [PATCH] Addressed undefined weather timestamp --- apps/mtnclock/ChangeLog | 1 + apps/mtnclock/app.js | 2 +- apps/mtnclock/metadata.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/mtnclock/ChangeLog b/apps/mtnclock/ChangeLog index cbf5c7f40..98cd0cc94 100644 --- a/apps/mtnclock/ChangeLog +++ b/apps/mtnclock/ChangeLog @@ -1,2 +1,3 @@ 0.01: New App! 0.02: Get weather from weather.json +0.03: Address unexpected undefined when reading weather.json \ No newline at end of file diff --git a/apps/mtnclock/app.js b/apps/mtnclock/app.js index c6adc7706..a65382dec 100644 --- a/apps/mtnclock/app.js +++ b/apps/mtnclock/app.js @@ -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, diff --git a/apps/mtnclock/metadata.json b/apps/mtnclock/metadata.json index 82a0cccab..2d3d0a02f 100644 --- a/apps/mtnclock/metadata.json +++ b/apps/mtnclock/metadata.json @@ -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",