diff options
-rw-r--r-- | context.cpp | 1 | ||||
-rw-r--r-- | gpgwin.cpp | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/context.cpp b/context.cpp index 736eba5..46dcbc6 100644 --- a/context.cpp +++ b/context.cpp @@ -320,6 +320,7 @@ bool Context::decrypt(const QByteArray &inBuffer, QByteArray *outBuffer) } if (err != GPG_ERR_NO_ERROR && err != GPG_ERR_CANCELED) { QMessageBox::critical(0, tr("Error decrypting:"), gpgme_strerror(err)); + return false; } //if (err != GPG_ERR_NO_ERROR) @@ -503,7 +503,12 @@ void GpgWin::decrypt() QByteArray *decrypted = new QByteArray(); QByteArray text = edit->curTextPage()->toPlainText().toAscii(); // TODO: toUtf8() here? preventNoDataErr(&text); - mCtx->decrypt(text, decrypted); + + // try decrypt, if fail do nothing, especially don't replace text + if(!mCtx->decrypt(text, decrypted)) { + return; + } + ; /** * 1) is it mime (content-type:) * 2) parse header |