Skip to content

Commit 9b740a0

Browse files
committed
Add detection for empty domain_objects
1 parent 4a50b31 commit 9b740a0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

plugwise/helper.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ def _get_locations(self) -> None:
229229
"""Collect all locations."""
230230
loc = Munch()
231231
locations = self._domain_objects.findall("./location")
232+
if not locations:
233+
raise KeyError("No data present!")
234+
232235
for location in locations:
233236
loc.loc_id = location.attrib["id"]
234237
loc.name = location.find("name").text

0 commit comments

Comments
 (0)