Fix settings and crash when no weather is available

master
Marco H 2022-10-25 08:40:39 +02:00 committed by Marco Heiming
parent 31ced9ea24
commit e0d86d60d8
2 changed files with 7 additions and 4 deletions

View File

@ -148,7 +148,10 @@ function draw() {
if (tempString) g.drawString(tempString, w, h2 + dowOffset);
const code = weather ? weather.code : -1;
g.drawImage(getWeatherIconByCode(code, true), w - 64, h1);
if (code > -1) {
const icon = getWeatherIconByCode(code, true);
if (icon) g.drawImage(icon, w - 48, h1, {scale:0.75});
}
}
drawCircle(1);

View File

@ -70,9 +70,9 @@
onchange: x => save('updateInterval', x),
},
/*LANG*/'show big weather': {
value: settings[showBigWeather] || false,
format: () => (settings[showBigWeather] ? 'Yes' : 'No'),
onchange: x => save(showBigWeather, x),
value: !!settings.showBigWeather,
format: () => (settings.showBigWeather ? 'Yes' : 'No'),
onchange: x => save('showBigWeather', x),
}
};
E.showMenu(menu);