KeychainChunk: Fix error handling in ReadJob::slotReadJobDone
authorMichael Schuster <michael@schuster.ms>
Tue, 24 Dec 2019 11:17:43 +0000 (12:17 +0100)
committerMichael Schuster <michael@schuster.ms>
Tue, 24 Dec 2019 11:17:43 +0000 (12:17 +0100)
Signed-off-by: Michael Schuster <michael@schuster.ms>
src/gui/creds/keychainchunk.cpp

index 4115c938dc019110acb5bcf2619417b8f139af76..ceacd27d7c938723cf8b482cc49b8e1d280e9f7d 100644 (file)
@@ -174,9 +174,6 @@ void ReadJob::slotReadJobDone(QKeychain::Job *incomingJob)
     QKeychain::ReadPasswordJob *readJob = static_cast<QKeychain::ReadPasswordJob *>(incomingJob);
 
     if (readJob) {
-        _error = readJob->error();
-        _errorString = readJob->errorString();
-
         if (readJob->error() == NoError && readJob->binaryData().length() > 0) {
             _chunkBuffer.append(readJob->binaryData());
             _chunkCount++;
@@ -205,7 +202,12 @@ void ReadJob::slotReadJobDone(QKeychain::Job *incomingJob)
             }
 #endif
         } else {
+            if (readJob->error() != QKeychain::Error::EntryNotFound ||
+                ((readJob->error() == QKeychain::Error::EntryNotFound) && _chunkCount == 0)) {
+                _error = readJob->error();
+                _errorString = readJob->errorString();
                 qCWarning(lcKeychainChunk) << "Unable to read" << readJob->key() << "chunk" << QString::number(_chunkCount) << readJob->errorString();
+            }
         }
 
         readJob->deleteLater();