mirror of https://github.com/espruino/BangleApps
Prevent exceptions if weather.json doesn't exist.
parent
f4f07806a6
commit
5c3b742a42
|
@ -324,8 +324,13 @@ function setWeather() {
|
|||
}
|
||||
|
||||
function readWeather() {
|
||||
data = require("Storage").readJSON('weather.json').weather;
|
||||
var weatherData = require("Storage").readJSON('weather.json', true);
|
||||
if (weatherData !== undefined) {
|
||||
if (weatherData.weather.time > data.time) {
|
||||
data = weatherData.weather;
|
||||
require("Storage").write('mtnclock.json', data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const _GB = global.GB;
|
||||
|
|
Loading…
Reference in New Issue