aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authorRobby Weinberg <wildwobby@wildwobby.com>2017-06-03 19:56:51 -0500
committerRobby Weinberg <wildwobby@wildwobby.com>2017-06-03 19:56:51 -0500
commit71f8249a084c087e1badbad4591829a07fe13b64 (patch)
tree1b4c893732d85c3982bc042bfdcf020e8f59ffa5 /src/wallet/wallet2.cpp
parentMerge pull request #2059 (diff)
downloadmonero-71f8249a084c087e1badbad4591829a07fe13b64.tar.xz
Prevent crash if performing certain actions before wallet is initialized
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r--src/wallet/wallet2.cpp4
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())