sc/source/core/data/table6.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 15960931988cfd898e14a12d6b9cddaf6d8b0ade
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Sun Aug 8 18:39:39 2021 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Sun Aug 8 19:38:22 2021 +0200

    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 <er...@redhat.com>
    Tested-by: Jenkins

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)

Reply via email to