| commit | 0985431e0c5e0baab80df0450c6b7a3699430c87 | [log] |
|---|---|---|
| author | László Németh <nemeth@numbertext.org> | Fri Jul 14 18:41:31 2023 +0200 |
| committer | László Németh <nemeth@numbertext.org> | Tue Jul 18 12:16:09 2023 +0200 |
| tree | 9c207741641068bfc24c484ef2c853da237052c1 | |
| parent | 44d41ab98f5210a37cbcd04819a38c08a01464d4 [diff] |
tdf#156286 sc: fix crash with column deletion Skip negative indices, which caused the crash, when more columns were deleted, than the remaining columns before them. Regression from commit dd8e061406fac581d399da088c7f0187278035dc "tdf#153437 sc: fix broken formatting without performance regression". Change-Id: I223e2fbb321fc4bd2ddb7a67a16a64c69e1e7872 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154445 Reviewed-by: Czeber László <czeber.laszloadam@nisz.hu> Tested-by: Jenkins Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit e4ae409b8e57f5efe53af7bacd08b0d226a0d96f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154456
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index dbcd594..18fac8d 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx
@@ -401,7 +401,7 @@ void ScTable::DeleteCol( for (SCCOL nCol = nStartCol + nSize; nCol < aCol.size(); ++nCol) aCol[nCol].SwapCol(aCol[nCol - nSize]); // When delete column(s), initialize the last columns from the default attributes for (SCCOL nCol = aCol.size() - nSize; nCol < aCol.size(); ++nCol) for (SCCOL nCol = aCol.size() < static_cast<SCCOL>(nSize) ? 0 : aCol.size() - nSize; nCol < aCol.size(); ++nCol) aCol[nCol].Init(nCol, aCol[nCol].GetTab(), rDocument, false); } else