Skip to content

Commit

Permalink
Improve handling empty map
Browse files Browse the repository at this point in the history
  • Loading branch information
PiotrMachowski committed May 23, 2022
1 parent 56f8cb6 commit 2764b3f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions custom_components/xiaomi_cloud_map_extractor/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,15 @@ def _handle_map_data(self, map_name: str):
# noinspection PyBroadException
try:
_LOGGER.debug("Map data retrieved")
self._set_map_data(map_data)
self._map_saved = map_stored
if self._map_data.image.is_empty:
if map_data.image.is_empty:
_LOGGER.debug("Map is empty")
self._status = CameraStatus.EMPTY_MAP
if self._map_data is None or self._map_data.image.is_empty:
self._set_map_data(map_data)
else:
_LOGGER.debug("Map is ok")
self._set_map_data(map_data)
self._status = CameraStatus.OK
except:
_LOGGER.warning("Unable to parse map data")
Expand Down

0 comments on commit 2764b3f

Please sign in to comment.