mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-17 08:32:13 +11:00
🐛 removed extremely low chance of overflow
This commit is contained in:
parent
3e0efa780b
commit
88a3d79f9c
1 changed files with 2 additions and 2 deletions
|
|
@ -22,11 +22,11 @@ bool Bank::GetChangeState() const noexcept { return save_flag.GetChangeState();
|
||||||
|
|
||||||
BankResponse Bank::GetBal(const std::string &name) const noexcept
|
BankResponse Bank::GetBal(const std::string &name) const noexcept
|
||||||
{
|
{
|
||||||
uint32_t res = 0;
|
uint64_t res = 0;
|
||||||
users.if_contains(name, [&res](const User &u) {
|
users.if_contains(name, [&res](const User &u) {
|
||||||
res = u.balance + 1;
|
res = u.balance + 1;
|
||||||
});
|
});
|
||||||
return res > 0 ? BankResponse(k200OK, res - 1) : BankResponse(k404NotFound, "User not found");
|
return res ? BankResponse(k200OK, res - 1) : BankResponse(k404NotFound, "User not found");
|
||||||
}
|
}
|
||||||
BankResponse Bank::GetLogs(const std::string &name) noexcept
|
BankResponse Bank::GetLogs(const std::string &name) noexcept
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue