From d65160e3cc9d649181b1cfacd418a39a3a8604c8 Mon Sep 17 00:00:00 2001 From: ubbo Date: Thu, 29 Dec 2011 02:00:14 +0000 Subject: fix crash on decrypt with no data git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@721 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- gpgcontext.cpp | 6 ++++-- main.cpp | 5 +++-- 2 files changed, 7 insertions(+), 4 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("
"); 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("
No private key with id ")) .append(result->recipients->keyid) .append(tr(" in keyring.")); + } else { + errorString.append(gpgErrString(err)).append("
"); } 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; } diff --git a/main.cpp b/main.cpp index aaf4e81..1c9b4b7 100644 --- a/main.cpp +++ b/main.cpp @@ -88,8 +88,9 @@ int main(int argc, char *argv[]) #endif app.installTranslator(&translator2); - /*foreach(QLocale l , QLocale::matchingLocales(lang, "", "")) { - qDebug << "l: " << l.toString(); + /*QLocale ql(lang); + foreach(QLocale l , QLocale::matchingLocales(ql.language(), ql.script(), ql.country())) { + qDebug() << "l: " << l.bcp47Name(); }*/ // css -- cgit v1.2.3