Skip to content

Commit

Permalink
Capture by copy
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushstar committed Jan 25, 2023
1 parent ca90ceb commit 8a8e1ff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/amount.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ struct CTokenAmount { // simple std::pair is less informative

Res Add(CAmount amount) {
// safety checks
Require(amount >= 0, [&]{ return strprintf("negative amount: %s", GetDecimaleString(amount)); });
Require(amount >= 0, [=]{ return strprintf("negative amount: %s", GetDecimaleString(amount)); });

// add
auto sumRes = SafeAdd(nValue, amount);
Expand All @@ -137,8 +137,8 @@ struct CTokenAmount { // simple std::pair is less informative

Res Sub(CAmount amount) {
// safety checks
Require(amount >= 0, [&]{ return strprintf("negative amount: %s", GetDecimaleString(amount)); });
Require(nValue >= amount, [&]{ return strprintf("amount %s is less than %s", GetDecimaleString(nValue), GetDecimaleString(amount)); });
Require(amount >= 0, [=]{ return strprintf("negative amount: %s", GetDecimaleString(amount)); });
Require(nValue >= amount, [=]{ return strprintf("amount %s is less than %s", GetDecimaleString(nValue), GetDecimaleString(amount)); });

// sub
nValue -= amount;
Expand Down

0 comments on commit 8a8e1ff

Please sign in to comment.