Fix iterating over NoneType exception (#23648)

* Fix iterating over NoneType exception

When self._dark_sky is None, don't try to return self._dark_sky.units

* Fix wrong check
pull/24022/head
Tyler Page 2019-05-21 12:26:11 +00:00 committed by Charles Garwood
parent fbd7c72283
commit eae306c3f1
1 changed files with 2 additions and 0 deletions

View File

@ -103,6 +103,8 @@ class DarkSkyWeather(WeatherEntity):
@property
def temperature_unit(self):
"""Return the unit of measurement."""
if self._dark_sky.units is None:
return None
return TEMP_FAHRENHEIT if 'us' in self._dark_sky.units \
else TEMP_CELSIUS