Skip to content

Commit

Permalink
Fix error when API doesn't return a forecast. (#20365)
Browse files Browse the repository at this point in the history
* add guard

* wrong logic
  • Loading branch information
dgomes authored and balloob committed Jan 24, 2019
1 parent 2b542b7 commit 65d9460
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions homeassistant/components/weather/ipma.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ def name(self):
@property
def condition(self):
"""Return the current condition."""
if not self._forecast:
return

return next((k for k, v in CONDITION_CLASSES.items()
if self._forecast[0].idWeatherType in v), None)

Expand Down

0 comments on commit 65d9460

Please sign in to comment.