Fix None dereferences in weather UI.

Also normalizes line endings.
This commit is contained in:
Dan Albert 2020-11-25 14:35:27 -08:00
parent afabf6fd00
commit 75ea5cc462
2 changed files with 285 additions and 280 deletions

View File

@ -183,8 +183,13 @@ class QWeatherWidget(QGroupBox):
"""Updates the Forecast Text and icon with the current conditions wind info.
"""
icon = []
cloudDensity = self.conditions.weather.clouds.density or 0
precipitation = self.conditions.weather.clouds.precipitation or None
if self.conditions.weather.clouds is None:
cloudDensity = 0
precipitation = None
else:
cloudDensity = self.conditions.weather.clouds.density
precipitation = self.conditions.weather.clouds.precipitation
fog = self.conditions.weather.fog or None
is_night = self.conditions.time_of_day == TimeOfDay.Night
time = 'night' if is_night else 'day'