diff options
author | Andrew Chow <achow101-github@achow101.com> | 2021-07-01 01:22:38 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2021-07-01 01:22:38 -0400 |
commit | b945a31afac63010fce782b8fbca96dee6b458c5 (patch) | |
tree | 9c93f45a3beef73163a2a456e8fbe6a4945ede4c /src/wallet/wallet.cpp | |
parent | 5a95c5179c391e0adba0bb308d200bf5a2e24b16 (diff) |
wallet: erase spkmans rather than setting to nullptr
In many places in ScriptPubKeyMan managing code, we assume that the
ScriptPubKeyMan being retrieved actually exists and is not a nullptr.
Thus removing a ScriptPubKeyMan requires erasing the object from the
map rather than setting it to a nullptr.
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r-- | src/wallet/wallet.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 1f736f8baf..173609e995 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3184,7 +3184,7 @@ void CWallet::LoadActiveScriptPubKeyMan(uint256 id, OutputType type, bool intern spk_mans[type] = spk_man; if (spk_mans_other[type] == spk_man) { - spk_mans_other[type] = nullptr; + spk_mans_other.erase(type); } NotifyCanGetAddressesChanged(); @@ -3201,7 +3201,7 @@ void CWallet::DeactivateScriptPubKeyMan(uint256 id, OutputType type, bool intern } auto& spk_mans = internal ? m_internal_spk_managers : m_external_spk_managers; - spk_mans[type] = nullptr; + spk_mans.erase(type); } NotifyCanGetAddressesChanged(); |