aboutsummaryrefslogtreecommitdiffstats
path: root/gpgcontext.cpp
diff options
context:
space:
mode:
authorubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2011-12-29 02:00:14 +0000
committerubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2011-12-29 02:00:14 +0000
commitd65160e3cc9d649181b1cfacd418a39a3a8604c8 (patch)
tree34b384324f7787485a1b38414b6f0d1e8cb9d076 /gpgcontext.cpp
parentenable zoom for help (diff)
downloadgpg4usb-d65160e3cc9d649181b1cfacd418a39a3a8604c8.tar.gz
gpg4usb-d65160e3cc9d649181b1cfacd418a39a3a8604c8.zip
fix crash on decrypt with no data
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@721 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to 'gpgcontext.cpp')
-rw-r--r--gpgcontext.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/gpgcontext.cpp b/gpgcontext.cpp
index 89a6bab..cf9cd1e 100644
--- a/gpgcontext.cpp
+++ b/gpgcontext.cpp
@@ -374,7 +374,7 @@ bool GpgContext::decrypt(const QByteArray &inBuffer, QByteArray *outBuffer)
err = gpgme_op_decrypt(mCtx, in, out);
checkErr(err);
- if(err) {
+ if(gpg_err_code(err) == GPG_ERR_DECRYPT_FAILED) {
errorString.append(gpgErrString(err)).append("<br>");
result = gpgme_op_decrypt_result(mCtx);
checkErr(result->recipients->status);
@@ -383,6 +383,8 @@ bool GpgContext::decrypt(const QByteArray &inBuffer, QByteArray *outBuffer)
errorString.append(tr("<br>No private key with id "))
.append(result->recipients->keyid)
.append(tr(" in keyring."));
+ } else {
+ errorString.append(gpgErrString(err)).append("<br>");
}
if (!err) {
@@ -397,7 +399,7 @@ bool GpgContext::decrypt(const QByteArray &inBuffer, QByteArray *outBuffer)
}
}
}
- if (err != GPG_ERR_NO_ERROR && err != GPG_ERR_CANCELED) {
+ if (gpg_err_code(err) != GPG_ERR_NO_ERROR && gpg_err_code(err) != GPG_ERR_CANCELED) {
QMessageBox::critical(0, tr("Error decrypting:"), errorString);
return false;
}