diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-09-09 11:34:45 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-09-25 15:48:06 +0100 |
commit | 4230876b31e56953fbd0e1193545611aac200048 (patch) | |
tree | 6d79b14466a94bffa5fbaf0cf08f92a399c2b46c /src/simplewallet/simplewallet.cpp | |
parent | daemon: initialize decode_as_json in RPC request (diff) | |
download | monero-4230876b31e56953fbd0e1193545611aac200048.tar.xz |
simplewallet: guard against I/O exceptions
CID 175308
Diffstat (limited to 'src/simplewallet/simplewallet.cpp')
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 481668299..575b711d5 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -1708,9 +1708,18 @@ bool simple_wallet::open_wallet(const boost::program_options::variables_map& vm) catch (const std::exception& e) { fail_msg_writer() << tr("failed to load wallet: ") << e.what(); - // only suggest removing cache if the password was actually correct - if (m_wallet && m_wallet->verify_password(password)) - fail_msg_writer() << boost::format(tr("You may want to remove the file \"%s\" and try again")) % m_wallet_file; + if (m_wallet) + { + // only suggest removing cache if the password was actually correct + bool password_is_correct = false; + try + { + password_is_correct = m_wallet->verify_password(password); + } + catch (...) { } // guard against I/O errors + if (password_is_correct) + fail_msg_writer() << boost::format(tr("You may want to remove the file \"%s\" and try again")) % m_wallet_file; + } return false; } success_msg_writer() << |