mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
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:
parent
fbd7c72283
commit
eae306c3f1
@ -103,6 +103,8 @@ class DarkSkyWeather(WeatherEntity):
|
|||||||
@property
|
@property
|
||||||
def temperature_unit(self):
|
def temperature_unit(self):
|
||||||
"""Return the unit of measurement."""
|
"""Return the unit of measurement."""
|
||||||
|
if self._dark_sky.units is None:
|
||||||
|
return None
|
||||||
return TEMP_FAHRENHEIT if 'us' in self._dark_sky.units \
|
return TEMP_FAHRENHEIT if 'us' in self._dark_sky.units \
|
||||||
else TEMP_CELSIUS
|
else TEMP_CELSIUS
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user