diff options
author | MarcoFalke <falke.marco@gmail.com> | 2018-11-14 11:26:51 -0500 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-11-14 11:27:01 -0500 |
commit | c7366d2399e2778ea2c6595b0fde5d5fb48141ed (patch) | |
tree | 355be9ceb939aceaa183526687b0954d55b1be47 /src/qt | |
parent | 2e8f9dc2bbb1200218feaf80344d35dca1cd6b25 (diff) | |
parent | b4f6e58ca5a74225b6db9deb3ffe1ce3ab19a790 (diff) |
Merge #14478: Show error to user when corrupt wallet unlock fails
b4f6e58ca5 Better error message for user when corrupt wallet unlock fails (MeshCollider)
Pull request description:
Mentioned here: https://github.com/bitcoin/bitcoin/issues/14461#issuecomment-429183503
Current behavior is to assert(false) and crash, only info is printed in the log. This shows the message to the user before abort() instead.
Tree-SHA512: 526f9ed9262257fca55caf7153ab913ed958b13b079d2f01db797485614d8c375815a1554276e8cf73d3838104b2691a9cf85c8d097973127ae8de9e111446bf
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/askpassphrasedialog.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/qt/askpassphrasedialog.cpp b/src/qt/askpassphrasedialog.cpp index a0270daf99..821c23c467 100644 --- a/src/qt/askpassphrasedialog.cpp +++ b/src/qt/askpassphrasedialog.cpp @@ -152,14 +152,15 @@ void AskPassphraseDialog::accept() } } break; case Unlock: - if(!model->setWalletLocked(false, oldpass)) - { - QMessageBox::critical(this, tr("Wallet unlock failed"), - tr("The passphrase entered for the wallet decryption was incorrect.")); - } - else - { - QDialog::accept(); // Success + try { + if (!model->setWalletLocked(false, oldpass)) { + QMessageBox::critical(this, tr("Wallet unlock failed"), + tr("The passphrase entered for the wallet decryption was incorrect.")); + } else { + QDialog::accept(); // Success + } + } catch (const std::runtime_error& e) { + QMessageBox::critical(this, tr("Wallet unlock failed"), e.what()); } break; case Decrypt: |