Home: Avoid breaking home if weather didn't find city

This commit is contained in:
nathan 2023-03-13 14:47:46 -06:00
parent 9a8375fa33
commit 41788aef00
2 changed files with 2 additions and 2 deletions

View File

@ -136,7 +136,7 @@ class home_weather_portlet extends home_portlet
$current = file_get_contents($url);
if($debug) error_log(__METHOD__ . ' current: ' . $current);
return array_merge(array('current' => json_decode($current,true)), json_decode($forecast,true));
return array_merge(array('current' => json_decode($current, true)), (array)json_decode($forecast, true));
}, array($query), self::CACHE_TIME);
// Some sample data, if you need to test

View File

@ -131,7 +131,7 @@ export class Et2PortletWeather extends Et2Portlet
const current = this.settings?.weather?.current || {weather: [{icon: "question-lg"}], temp: {temp: "?"}};
// Get the forecast, excluding today
let list = this.settings.weather && (Object.values(this.settings?.weather?.list).slice(1) || []);
let list = this.settings.weather && (Object.values(this.settings?.weather?.list || {}).slice(1) || []);
return html`
<div