From 88a3d79f9c5fb1f29c51ea0daa22946b9aea99e5 Mon Sep 17 00:00:00 2001 From: EntireTwix Date: Thu, 1 Jul 2021 23:58:27 -0700 Subject: [PATCH] :bug: removed extremely low chance of overflow --- src/bank.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bank.cpp b/src/bank.cpp index c1cb885..f8d00fc 100644 --- a/src/bank.cpp +++ b/src/bank.cpp @@ -22,11 +22,11 @@ bool Bank::GetChangeState() const noexcept { return save_flag.GetChangeState(); 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) { 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 {