mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-16 16:12:14 +11:00
🐛 fixed seg fault bug (I think)
This commit is contained in:
parent
a5da4c9a04
commit
5feb20754a
1 changed files with 8 additions and 12 deletions
20
src/bank.cpp
20
src/bank.cpp
|
|
@ -187,21 +187,17 @@ BankResponse Bank::PruneUsers(time_t threshold_time, uint32_t threshold_bal) noe
|
|||
size_t deleted_count = 0;
|
||||
for (const auto &u : users)
|
||||
{
|
||||
users.erase_if(u.first, [this, threshold_time, threshold_bal, &deleted_count](User &u) -> bool {
|
||||
if (users.erase_if(u.first, [threshold_time, threshold_bal, &deleted_count](User &u) -> bool {
|
||||
#if MAX_LOG_SIZE > 0
|
||||
if (u.log.data.back().time < threshold_time && u.balance < threshold_bal)
|
||||
return (u.log.data.back().time < threshold_time && u.balance < threshold_bal);
|
||||
#else
|
||||
if (u.balance < threshold_bal)
|
||||
return (u.balance < threshold_bal);
|
||||
#endif
|
||||
{
|
||||
SET_CHANGES_ON;
|
||||
return ++deleted_count;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}))
|
||||
{
|
||||
SET_CHANGES_ON;
|
||||
++deleted_count;
|
||||
}
|
||||
}
|
||||
return {k200OK, std::to_string(deleted_count)};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue