sc/source/core/data/table2.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit d721bdf53687a0e5b280f29479a55fafd354b4f6
Author:     Luboš Luňák <[email protected]>
AuthorDate: Fri Feb 25 11:29:00 2022 +0100
Commit:     Luboš Luňák <[email protected]>
CommitDate: Fri Feb 25 14:20:11 2022 +0100

    don't try to delete unallocated columns
    
    Change-Id: I1508f9eb624a78946f5216078953ce8f95e566b0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130522
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <[email protected]>

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index e0753b15d252..ee4be3d802b3 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -235,7 +235,7 @@ void ScTable::DeleteRow(
 
     {   // scope for bulk broadcast
         ScBulkBroadcast aBulkBroadcast( rDocument.GetBASM(), 
SfxHintId::ScDataChanged);
-        for (SCCOL j=nStartCol; j<=nEndCol; j++)
+        for (SCCOL j=nStartCol; j<=ClampToAllocatedColumns(nEndCol); j++)
             aCol[j].DeleteRow(nStartRow, nSize, pGroupPos);
     }
 
@@ -384,8 +384,8 @@ void ScTable::DeleteCol(
         }
     }
 
-    for (SCSIZE i = 0; i < nSize; i++)
-        aCol[nStartCol + i].DeleteArea(nStartRow, nEndRow, 
InsertDeleteFlags::ALL, false);
+    for (SCCOL col = nStartCol; col <= ClampToAllocatedColumns(nStartCol + 
nSize - 1); ++col)
+        aCol[col].DeleteArea(nStartRow, nEndRow, InsertDeleteFlags::ALL, 
false);
 
     if ((nStartRow == 0) && (nEndRow == rDocument.MaxRow()))
     {

Reply via email to