aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wallet/wallet.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 55f8f1b9b5..e392f7f8aa 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -2359,14 +2359,15 @@ bool CWallet::SetAddressBookWithDB(WalletBatch& batch, const CTxDestination& add
{
LOCK(cs_wallet);
std::map<CTxDestination, CAddressBookData>::iterator mi = m_address_book.find(address);
- fUpdated = (mi != m_address_book.end() && !mi->second.IsChange());
- m_address_book[address].SetLabel(strName);
+ fUpdated = mi != m_address_book.end() && !mi->second.IsChange();
+
+ CAddressBookData& record = mi != m_address_book.end() ? mi->second : m_address_book[address];
+ record.SetLabel(strName);
is_mine = IsMine(address) != ISMINE_NO;
if (new_purpose) { /* update purpose only if requested */
- purpose = m_address_book[address].purpose = new_purpose;
- } else {
- purpose = m_address_book[address].purpose;
+ record.purpose = new_purpose;
}
+ purpose = record.purpose;
}
const std::string& encoded_dest = EncodeDestination(address);