summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2021-08-08 18:39:39 +0200
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2021-08-08 22:50:31 +0200
commitf20c91fe2c997bd5966c902ee28f95531435ec26 (patch)
tree090d7cd3d77d1ecb2dcbb14844e72d3ed3b4c69f
parent9a3acd91284d40714fdf08868e34e64de6e8ad2b (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 (cherry picked from commit 15960931988cfd898e14a12d6b9cddaf6d8b0ade) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120135 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-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)