Fix searching past the end

This commit is contained in:
Nicolas Werner 2022-12-19 03:42:43 +01:00
parent 51cbe0f6d8
commit b314f41f6b
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9

View file

@ -61,8 +61,13 @@ TimelineFilter::event(QEvent *ev)
incrementalSearchIndex += 30;
if (auto s = source(); s) {
auto count = s->rowCount();
if (incrementalSearchIndex >= count) {
incrementalSearchIndex = std::numeric_limits<int>::max();
}
nhlog::ui()->debug("Filter progress {}/{}", incrementalSearchIndex, count);
s->dataChanged(s->index(orgIndex),
s->index(std::min(incrementalSearchIndex, s->rowCount() - 1)),
s->index(std::min(incrementalSearchIndex, count - 1)),
{FilterRole});
continueFiltering();
}