summaryrefslogtreecommitdiff
path: root/sc/source/core
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2021-08-08 18:39:39 +0200
committerEike Rathke <erack@redhat.com>2021-08-08 19:38:22 +0200
commit15960931988cfd898e14a12d6b9cddaf6d8b0ade (patch)
tree10c4685b9201c85da951342044170c6a69723c3c /sc/source/core
parent360b9c7d6ee29943475e706582ad1e3d923b592d (diff)
Resolves: tdf#143759 Limit empty search's empty column to actual search range
... instead of the non-/filtered last row. Change-Id: I9b941af688a8083d472a793a6bc6b6dbb7b916ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120176 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'sc/source/core')
-rw-r--r--sc/source/core/data/table6.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index b52247f35e14..fca6dea1c61b 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -1081,10 +1081,14 @@ bool ScTable::SearchRangeForAllEmptyCells(
if (aCol[nCol].IsEmptyData())
{
// The entire column is empty.
- for (SCROW nRow = rRange.aStart.Row(); nRow <= rRange.aEnd.Row(); ++nRow)
+ const SCROW nEndRow = rRange.aEnd.Row();
+ for (SCROW nRow = rRange.aStart.Row(); nRow <= nEndRow; ++nRow)
{
SCROW nLastRow;
- if (!RowFiltered(nRow, nullptr, &nLastRow))
+ const bool bFiltered = RowFiltered(nRow, nullptr, &nLastRow);
+ if (nLastRow > nEndRow)
+ nLastRow = nEndRow;
+ if (!bFiltered)
{
rMatchedRanges.Join(ScRange(nCol, nRow, nTab, nCol, nLastRow, nTab));
if (bReplace)