From 576116d415b7ea9b498168db6221ab5df6101c31 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Mon, 11 Mar 2019 16:11:48 +0000 Subject: [PATCH] wallet: fix load failure if the mms isn't usable --- src/simplewallet/simplewallet.cpp | 10 ++++++++++ src/wallet/wallet2.cpp | 9 ++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 8c0b300ad..cf75d57eb 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -9952,6 +9952,16 @@ void simple_wallet::mms_auto_config(const std::vector &args) bool simple_wallet::mms(const std::vector &args) { + try + { + m_wallet->get_multisig_wallet_state(); + } + catch(const std::exception &e) + { + fail_msg_writer() << tr("MMS not available in this wallet"); + return true; + } + try { mms::message_store& ms = m_wallet->get_message_store(); diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 085e6075f..3b9e2c469 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -5085,7 +5085,14 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass MERROR("Failed to save rings, will try again next time"); } - m_message_store.read_from_file(get_multisig_wallet_state(), m_mms_file); + try + { + m_message_store.read_from_file(get_multisig_wallet_state(), m_mms_file); + } + catch (const std::exception &e) + { + MERROR("Failed to initialize MMS, it will be unusable"); + } } //---------------------------------------------------------------------------------------------------- void wallet2::trim_hashchain()