Skip to content
This repository was archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
Add else condition if API call returns none (Sourcery refactored) (#12)
Browse files Browse the repository at this point in the history
* Add else condition if API call returns none

I was getting exceptions when the API call returned none.

* 'Refactored by Sourcery'

Co-authored-by: Brian Orpin <brian.orpin@gmail.com>
Co-authored-by: Sourcery AI <>
  • Loading branch information
sourcery-ai[bot] and borpin authored Apr 7, 2022
1 parent ee1e7e7 commit 616f0db
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions custom_components/vesync/pyvesync/vesyncfan.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,9 +877,10 @@ def get_details(self) -> None:
)
if r is None or not isinstance(r, dict):
logger.debug("Error getting status of %s ", self.device_name)
outer_result = r.get("result", {})
outer_result = None
else:
outer_result = r.get("result", {})
inner_result = None

if outer_result is not None:
inner_result = r.get("result", {}).get("result")
if inner_result is not None and Helpers.code_check(r):
Expand Down

0 comments on commit 616f0db

Please sign in to comment.