sc/source/core/data/table2.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
New commits: commit 7b6812c267356a7fb204b393f4625f8ff4fd296e Author: László Németh <nem...@numbertext.org> AuthorDate: Fri Jul 14 18:41:31 2023 +0200 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Tue Jul 18 11:22:44 2023 +0200 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.laszloa...@nisz.hu> Tested-by: Jenkins Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154575 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index a4758d088ac0..53ba083929c4 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -400,8 +400,8 @@ void ScTable::DeleteCol( { for (SCCOL nCol = nStartCol + nSize; nCol < aCol.size(); ++nCol) aCol[nCol].SwapCol(aCol[nCol - nSize]); - // When delete column(s), inicialize the last columns from the default attributes - for (SCCOL nCol = aCol.size() - nSize; nCol < aCol.size(); ++nCol) + // When delete column(s), initialize the last columns from the default attributes + 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