🐛 finally fixed big "end" bug

This commit is contained in:
EntireTwix 2021-05-29 21:26:11 -07:00
parent a799a606ff
commit cc3aa0882a
2 changed files with 4 additions and 4 deletions

View file

@ -31,7 +31,7 @@ struct Log
Json::Value Serialize() const Json::Value Serialize() const
{ {
Json::Value res; Json::Value res;
for (uint32_t i = 0; i < end && data[i].amount; ++i) for (uint32_t i = 0; i < end + 1; ++i)
{ {
res[i]["to"] = data[i].to; res[i]["to"] = data[i].to;
res[i]["from"] = data[i].from; res[i]["from"] = data[i].from;

View file

@ -37,13 +37,13 @@ struct User
{ {
if (max_log_size > (log_j.size() + pre_log_size)) if (max_log_size > (log_j.size() + pre_log_size))
{ {
log.data.resize(log_j.size() + pre_log_size); log.data.resize(log_j.size() + pre_log_size - 1);
log.end = log_j.size(); log.end = log_j.size() - 1;
} }
else else
{ {
log.data.resize(max_log_size); log.data.resize(max_log_size);
log.end = max_log_size; log.end = max_log_size - 1;
} }
for (uint32_t i = 0; i < log.end; ++i) for (uint32_t i = 0; i < log.end; ++i)
{ {