mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-17 00:22:14 +11:00
🐛 undeflow check
This commit is contained in:
parent
0c518c4ede
commit
e3210f7337
1 changed files with 1 additions and 1 deletions
|
|
@ -177,7 +177,7 @@ BankResponse Bank::ImpactBal(const std::string &name, int64_t amount) noexcept
|
|||
{
|
||||
return {k400BadRequest, "\"Amount cannot be 0\""};
|
||||
}
|
||||
if (users.modify_if(name, [amount](User &u) { u.balance += amount; }))
|
||||
if (users.modify_if(name, [amount](User &u) { u.balance < (amount*-1)? u.balance = 0 : u.balance += amount; }))
|
||||
{
|
||||
#if CONSERVATIVE_DISK_SAVE
|
||||
#if MULTI_THREADED
|
||||
|
|
|
|||
Loading…
Reference in a new issue