Add else condition if API call returns none (Sourcery refactored) (#12)

* 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 <>
This commit is contained in:
sourcery-ai[bot] 2022-04-07 17:13:33 +02:00 committed by GitHub
parent ee1e7e7496
commit 616f0db5ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -877,9 +877,10 @@ class VeSyncHumid200300S(VeSyncBaseDevice):
)
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):