mirror of
https://github.com/monero-project/monero.git
synced 2024-12-23 12:09:54 +00:00
wallet fix: ensure iterator to be valid
This commit is contained in:
parent
694470fae7
commit
6cb1ad1fa2
1 changed files with 3 additions and 0 deletions
|
@ -4266,7 +4266,10 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
|
||||||
std::vector<cryptonote::tx_destination_entry>::iterator i;
|
std::vector<cryptonote::tx_destination_entry>::iterator i;
|
||||||
i = std::find_if(dsts.begin(), dsts.end(), [&](const cryptonote::tx_destination_entry &d) { return !memcmp (&d.addr, &addr, sizeof(addr)); });
|
i = std::find_if(dsts.begin(), dsts.end(), [&](const cryptonote::tx_destination_entry &d) { return !memcmp (&d.addr, &addr, sizeof(addr)); });
|
||||||
if (i == dsts.end())
|
if (i == dsts.end())
|
||||||
|
{
|
||||||
dsts.push_back(tx_destination_entry(0,addr));
|
dsts.push_back(tx_destination_entry(0,addr));
|
||||||
|
i = dsts.end() - 1;
|
||||||
|
}
|
||||||
i->amount += amount;
|
i->amount += amount;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue