From 3965cc0ce3807a6b98d64bf20ea1752cf539e57c Mon Sep 17 00:00:00 2001 From: EntireTwix Date: Wed, 21 Apr 2021 19:20:40 -0700 Subject: [PATCH] :bug: fixed last commit --- include/bank.hpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/bank.hpp b/include/bank.hpp index 04a44f5..c86bfa6 100644 --- a/include/bank.hpp +++ b/include/bank.hpp @@ -61,25 +61,27 @@ public: bool DelUser(const std::string &name, const std::string &attempt) { + bool state; { std::shared_lock lock{size_l}; - bool state = users.erase_if(name, [&attempt](User &u) { return (XXH3_64bits(attempt.data(), attempt.size()) == u.password); }); + state = users.erase_if(name, [&attempt](User &u) { return (XXH3_64bits(attempt.data(), attempt.size()) == u.password); }); } if (state) { - logs.erase_if(name, [](User &u) {}) + logs.erase(name); } return state; } bool AdminDelUser(const std::string &name, const std::string &attempt) { + bool state; { std::shared_lock lock{size_l}; - bool state = users.erase_if(name, [this, &attempt](const User &) { return (admin_pass == attempt); }); + state = users.erase_if(name, [this, &attempt](const User &) { return (admin_pass == attempt); }); } if (state) { - logs.erase_if(name, [](User &u) {}); + logs.erase(name); } return state; }