summaryrefslogtreecommitdiff
path: root/community/trojita/trojita-fix-crash.patch
blob: 9a30272800df8d9a7910dd96f8beb9e25cb6ce83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
diff --git a/src/Imap/Network/FileDownloadManager.cpp b/src/Imap/Network/FileDownloadManager.cpp
index 16b6c8dfc93727bd1696abaab8336b06794b3a02..c3f72176abdfd0981a5ac37ec69060fb3c7aa797 100644
--- a/src/Imap/Network/FileDownloadManager.cpp
+++ b/src/Imap/Network/FileDownloadManager.cpp
@@ -139,7 +139,9 @@ void FileDownloadManager::downloadMessage()
 
 void FileDownloadManager::onPartDataTransfered()
 {
-    Q_ASSERT(reply);
+    if (!reply) {
+        return;
+    }
     if (reply->error() == QNetworkReply::NoError) {
         if (!saving.open(QIODevice::WriteOnly)) {
             emit transferError(saving.errorString());
@@ -192,11 +194,11 @@ void FileDownloadManager::onCombinerTransferError(const QString &message)
 
 void FileDownloadManager::deleteReply(QNetworkReply *reply)
 {
-    if (reply == this->reply) {
+    if (reply && reply == this->reply) {
         if (!saved)
             onPartDataTransfered();
-        delete reply;
-        this->reply = 0;
+        reply->deleteLater();
+        this->reply = nullptr;
     }
 }