mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Don't crash if the Weather API is missing or invalid
This commit is contained in:
parent
6aec41df53
commit
9cc44a97c2
@ -74,7 +74,9 @@ func (widget *Widget) Fetch(cityIDs []int) []*owm.CurrentWeatherData {
|
|||||||
// Refresh fetches new data from the OpenWeatherMap API and loads the new data into the.
|
// Refresh fetches new data from the OpenWeatherMap API and loads the new data into the.
|
||||||
// widget's view for rendering
|
// widget's view for rendering
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
widget.Data = widget.Fetch(wtf.ToInts(Config.UList("wtf.mods.weather.cityids", widget.defaultCityCodes())))
|
if widget.apiKeyValid() {
|
||||||
|
widget.Data = widget.Fetch(wtf.ToInts(Config.UList("wtf.mods.weather.cityids", widget.defaultCityCodes())))
|
||||||
|
}
|
||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
widget.display()
|
widget.display()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user