aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-09-10 11:50:17 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-09-25 15:48:30 +0100
commited4a33502da59d7286d32c9e035eacf3a288cd55 (patch)
tree3b9f61e379aec32f37ccb4601f6b3bf6e0478592
parentwallet2_api: check whether dynamic_cast returns NULL (diff)
downloadmonero-ed4a33502da59d7286d32c9e035eacf3a288cd55.tar.xz
wallet2: catch failure to save keys file
CID 161848
-rw-r--r--src/wallet/wallet2.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 805703027..38d1bcb44 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -2653,10 +2653,11 @@ void wallet2::store_to(const std::string &path, const std::string &password)
// if we here, main wallet file is saved and we only need to save keys and address files
if (!same_file) {
prepare_file_names(path);
- store_keys(m_keys_file, password, false);
+ bool r = store_keys(m_keys_file, password, false);
+ THROW_WALLET_EXCEPTION_IF(!r, error::file_save_error, m_keys_file);
// save address to the new file
const std::string address_file = m_wallet_file + ".address.txt";
- bool r = file_io_utils::save_string_to_file(address_file, m_account.get_public_address_str(m_testnet));
+ r = file_io_utils::save_string_to_file(address_file, m_account.get_public_address_str(m_testnet));
THROW_WALLET_EXCEPTION_IF(!r, error::file_save_error, m_wallet_file);
// remove old wallet file
r = boost::filesystem::remove(old_file);