Don't crash when cloud response is invalid JSON

Perhaps if the connection is interrupted this could happen.

Fixes Sentry issue CURA-1QX.
This commit is contained in:
Ghostkeeper 2021-02-04 17:05:45 +01:00
parent adacb95dc6
commit 577e45595e
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -43,6 +43,10 @@ class DriveApiService:
return return
backup_list_response = HttpRequestManager.readJSON(reply) backup_list_response = HttpRequestManager.readJSON(reply)
if backup_list_response is None:
Logger.error("List of back-ups can't be parsed.")
changed([])
return
if "data" not in backup_list_response: if "data" not in backup_list_response:
Logger.log("w", "Could not get backups from remote, actual response body was: %s", Logger.log("w", "Could not get backups from remote, actual response body was: %s",
str(backup_list_response)) str(backup_list_response))