diff options
| author | Riccardo Spagni <ric@spagni.net> | 2017-06-18 16:43:35 +0200 |
|---|---|---|
| committer | Riccardo Spagni <ric@spagni.net> | 2017-06-18 16:43:35 +0200 |
| commit | 88b7cb9bda5961cb42ca65cf2a733c0e0f395090 (patch) | |
| tree | 70feb0f3ef4b0db9ba0c600d0205570a9a300b62 /src/wallet/wallet2.cpp | |
| parent | ace1440b65915626d76a3101e0f3e5a6fbc3d73e (diff) | |
| parent | 71f8249a084c087e1badbad4591829a07fe13b64 (diff) | |
| download | monzero-core-88b7cb9bda5961cb42ca65cf2a733c0e0f395090.tar.gz monzero-core-88b7cb9bda5961cb42ca65cf2a733c0e0f395090.tar.xz monzero-core-88b7cb9bda5961cb42ca65cf2a733c0e0f395090.zip | |
Merge pull request #2070
71f8249a Prevent crash if performing certain actions before wallet is initialized (Robby Weinberg)
Diffstat (limited to 'src/wallet/wallet2.cpp')
| -rw-r--r-- | src/wallet/wallet2.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 96ba04c47..ee2b6055c 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -511,6 +511,7 @@ bool wallet2::init(std::string daemon_address, boost::optional<epee::net_utils:: { if(m_http_client.is_connected()) m_http_client.disconnect(); + m_is_initialized = true; m_upper_transaction_size_limit = upper_transaction_size_limit; m_daemon_address = std::move(daemon_address); m_daemon_login = std::move(daemon_login); @@ -1845,6 +1846,7 @@ void wallet2::detach_blockchain(uint64_t height) //---------------------------------------------------------------------------------------------------- bool wallet2::deinit() { + m_is_initialized=false; return true; } //---------------------------------------------------------------------------------------------------- @@ -2361,6 +2363,8 @@ bool wallet2::prepare_file_names(const std::string& file_path) //---------------------------------------------------------------------------------------------------- bool wallet2::check_connection(uint32_t *version, uint32_t timeout) { + THROW_WALLET_EXCEPTION_IF(!m_is_initialized, error::wallet_not_initialized); + boost::lock_guard<boost::mutex> lock(m_daemon_rpc_mutex); if(!m_http_client.is_connected()) |
