sc/source/core/data/markmulti.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 2490715c112699487915865f4267a880fe7bc4b3
Author:     hasban12138 <1483478...@qq.com>
AuthorDate: Thu Apr 28 15:13:39 2022 +0800
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Fri May 6 14:03:28 2022 +0200

    tdf#148837: fix cell range negative selection
    
    In Calc when you select all and then do negative selection, there has a
    bug. The reason is in ScMultiSel::SetMarkArea that case will make nBeg
    larger than nEndRow and in MarkAllCols start will be larger than end.
    So I added a condition in the if clause to make sure that nBeg is not
    larger than nEndRow.
    
    Change-Id: I7f39a588bf928b2885207810534d78481589c2f4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133538
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/core/data/markmulti.cxx 
b/sc/source/core/data/markmulti.cxx
index 6e63bbf191f2..3d8aef3cfafc 100644
--- a/sc/source/core/data/markmulti.cxx
+++ b/sc/source/core/data/markmulti.cxx
@@ -231,7 +231,7 @@ void ScMultiSel::SetMarkArea( SCCOL nStartCol, SCCOL 
nEndCol, SCROW nStartRow, S
                 nLast = aRowSel.GetMarkEnd( nBeg, false );
         }
 
-        if ( nBeg != mrSheetLimits.GetMaxRowCount() && nLast >= nEndRow )
+        if ( nBeg != mrSheetLimits.GetMaxRowCount() && nLast >= nEndRow && 
nBeg <= nEndRow )
             MarkAllCols( nBeg, nEndRow );
         else
         {
@@ -242,7 +242,7 @@ void ScMultiSel::SetMarkArea( SCCOL nStartCol, SCCOL 
nEndCol, SCROW nStartRow, S
                 if ( nBeg != mrSheetLimits.GetMaxRowCount() )
                     nLast = aRowSel.GetMarkEnd( nBeg, false );
             }
-            if ( nBeg != mrSheetLimits.GetMaxRowCount() && nLast >= nEndRow )
+            if ( nBeg != mrSheetLimits.GetMaxRowCount() && nLast >= nEndRow && 
nBeg <= nEndRow )
                 MarkAllCols( nBeg, nEndRow );
         }
 

Reply via email to