🐛 seg fault bug fixed

This commit is contained in:
EntireTwix 2021-05-29 20:11:02 -07:00
parent 7972f9857d
commit c833f66d9f
2 changed files with 5 additions and 5 deletions

View file

@ -173,7 +173,7 @@ public:
{
if constexpr (max_log_size)
{
Json::Value res;
Json::Value res;
if (!users.if_contains(name, [&res, &attempt](const User &u) {
if (u.password != XXH3_64bits(attempt.data(), attempt.size()))
{
@ -187,7 +187,7 @@ public:
{
return -1;
}
return res;
return res;
}
else
{

View file

@ -10,9 +10,9 @@ struct Log
uint32_t end = 0;
void AddTrans(Transaction &&v)
{
if (data.size() <= end+1 && end+1 < max_log_size) //if memory reserved is full
if (data.size() <= end + 1 && end + 1 < max_log_size) //if memory reserved is full
{
if(data.size() + pre_log_size > max_log_size)
if (data.size() + pre_log_size > max_log_size)
{
data.resize(max_log_size);
}
@ -26,7 +26,7 @@ struct Log
data[i] = std::move(data[i - 1]);
}
data[0] = std::move(v);
end += (end < max_log_size); //branchless
end += (end + 1 < max_log_size); //branchless
}
Json::Value Serialize() const
{