diff options
author | Kostas Karmas <konskarm@gmail.com> | 2020-09-24 13:08:16 +0300 |
---|---|---|
committer | Kostas Karmas <konskarm@gmail.com> | 2020-09-24 13:08:16 +0300 |
commit | 3d2d651b739cc62089973c47b5be324afb1e05dc (patch) | |
tree | 3675868a1df660eafed58d85c102a65827a8a8de /plugins | |
parent | 8ff8a2292c633ab0b3ecb0006f61d3c0398d4fb8 (diff) |
Fix crashing if QNetworkReply contains no status code
Display an appropriate message instead
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/UM3NetworkPrinting/src/Cloud/ToolPathUploader.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/UM3NetworkPrinting/src/Cloud/ToolPathUploader.py b/plugins/UM3NetworkPrinting/src/Cloud/ToolPathUploader.py index 3c80565fa1..5a3e2474a8 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/ToolPathUploader.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/ToolPathUploader.py @@ -108,7 +108,11 @@ class ToolPathUploader: Logger.log("i", "Finished callback %s %s", reply.attribute(QNetworkRequest.HttpStatusCodeAttribute), reply.url().toString()) - status_code = reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) # type: int + status_code = reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) # type: Optional[int] + if not status_code: + Logger.log("e", "Reply contained no status code.") + self._errorCallback(reply, None) + return # check if we should retry the last chunk if self._retries < self.MAX_RETRIES and status_code in self.RETRY_HTTP_CODES: |