🐛 fixed seg fault bug (I think)

This commit is contained in:
EntireTwix 2021-07-20 00:28:06 -07:00
parent a5da4c9a04
commit 5feb20754a

View file

@ -187,21 +187,17 @@ BankResponse Bank::PruneUsers(time_t threshold_time, uint32_t threshold_bal) noe
size_t deleted_count = 0; size_t deleted_count = 0;
for (const auto &u : users) 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 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 #else
if (u.balance < threshold_bal) return (u.balance < threshold_bal);
#endif #endif
{ }))
SET_CHANGES_ON; {
return ++deleted_count; SET_CHANGES_ON;
} ++deleted_count;
else }
{
return false;
}
});
} }
return {k200OK, std::to_string(deleted_count)}; return {k200OK, std::to_string(deleted_count)};
} }