Skip to content

Commit

Permalink
Don't crash if the Weather API is missing or invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Cummer committed Jun 13, 2018
1 parent 6aec41d commit 9cc44a9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion weather/widget.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
// widget's view for rendering
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.display()
Expand Down

0 comments on commit 9cc44a9

Please sign in to comment.