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
This commit is contained in:
Tyler Page 2019-05-21 12:26:11 +00:00 committed by Charles Garwood
parent fbd7c72283
commit eae306c3f1

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