Skip to content

Commit

Permalink
Fixes crash on missing report values
Browse files Browse the repository at this point in the history
  • Loading branch information
FL550 committed Oct 17, 2023
1 parent 6d1edb8 commit eb79091
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="simple_dwd_weatherforecast",
version="2.0.18",
version="2.0.19",
author="Max Fermor",
description="A simple tool to retrieve a weather forecast from DWD OpenData",
long_description=long_description,
Expand Down
6 changes: 5 additions & 1 deletion simple_dwd_weatherforecast/dwdforecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,11 @@ def get_reported_weather(self, weatherDataType: WeatherDataType, shouldUpdate=Tr
self.report_data[WeatherDataType.CONDITION.value[0]]
]
else:
return self.report_data[weatherDataType.value[0]]
return (
self.report_data[weatherDataType.value[0]]
if weatherDataType.value[0] in self.report_data
else None
)
else:
print("no report for this station available. Have you updated first?")

Expand Down

0 comments on commit eb79091

Please sign in to comment.