diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2022-12-19 03:42:43 +0100 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2022-12-19 03:42:43 +0100 |
commit | b314f41f6b5819144ff66cc406e669659b265364 (patch) | |
tree | 76f5c8b52eaedd73acff6d3c8ac79e3a9ec71365 | |
parent | Add some documentation for how the background filtering works (diff) | |
download | nheko-b314f41f6b5819144ff66cc406e669659b265364.tar.xz |
Fix searching past the end
-rw-r--r-- | src/timeline/TimelineFilter.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/timeline/TimelineFilter.cpp b/src/timeline/TimelineFilter.cpp index 36228c7c..80a4425d 100644 --- a/src/timeline/TimelineFilter.cpp +++ b/src/timeline/TimelineFilter.cpp @@ -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(); } |