Fixes segfault

develop
Josh Cooper 2022-11-06 17:30:28 -08:00 committed by GitHub
parent ba2e71c7be
commit 2197aded30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

@ -904,7 +904,10 @@ static void manageReportEvent(color_ostream& out) {
std::vector<df::report*>& reports = df::global::world->status.reports; std::vector<df::report*>& reports = df::global::world->status.reports;
size_t idx = df::report::binsearch_index(reports, lastReport, false); size_t idx = df::report::binsearch_index(reports, lastReport, false);
// returns the index to the key equal to or greater than the key provided // returns the index to the key equal to or greater than the key provided
idx = reports[idx]->id == lastReport ? idx + 1 : idx; // we need the index after (where the new stuff is) while (idx < reports.size() && reports[idx]->id <= lastReport) {
idx++;
}
// returns the index to the key equal to or greater than the key provided
for ( ; idx < reports.size(); idx++ ) { for ( ; idx < reports.size(); idx++ ) {
df::report* report = reports[idx]; df::report* report = reports[idx];