From 2197aded309d3af08a14b3df8463e3aa38a82789 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Sun, 6 Nov 2022 17:30:28 -0800 Subject: [PATCH] Fixes segfault --- library/modules/EventManager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/modules/EventManager.cpp b/library/modules/EventManager.cpp index 5d2a24ad0..d8f8543a0 100644 --- a/library/modules/EventManager.cpp +++ b/library/modules/EventManager.cpp @@ -904,7 +904,10 @@ static void manageReportEvent(color_ostream& out) { std::vector& reports = df::global::world->status.reports; size_t idx = df::report::binsearch_index(reports, lastReport, false); // 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++ ) { df::report* report = reports[idx];