diff options
author | Ghostkeeper <rubend@tutanota.com> | 2022-05-19 12:35:58 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2022-05-19 12:36:16 +0300 |
commit | 64b29779ca808119458eb52d0add91a87c9a25b6 (patch) | |
tree | bb188800025badb49f0cd011567c06071969ed89 | |
parent | c41c59da131eb9762a49043d4e20389c5d61aba4 (diff) |
Fix crash when server sends invalid JSON data
If readJSON fails, it puts an entry in the log and then returns None. This then crashes with a TypeError because you can't check for things to be in None.
Fixes Sentry issue CURA-3V5.
-rw-r--r-- | plugins/Marketplace/LocalPackageList.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/Marketplace/LocalPackageList.py b/plugins/Marketplace/LocalPackageList.py index ae719b2699..85f835980b 100644 --- a/plugins/Marketplace/LocalPackageList.py +++ b/plugins/Marketplace/LocalPackageList.py @@ -108,7 +108,7 @@ class LocalPackageList(PackageList): :param reply: A reply containing information about a number of packages. """ response_data = HttpRequestManager.readJSON(reply) - if "data" not in response_data: + if response_data is None or "data" not in response_data: Logger.error( f"Could not interpret the server's response. Missing 'data' from response data. Keys in response: {response_data.keys()}") return |