sc/source/core/data/table3.cxx | 2 ++ 1 file changed, 2 insertions(+) New commits: commit dde866578eff5eaf1d59c5a98d3e72ce87718b00 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Tue Mar 29 19:59:01 2022 +0200 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Tue Mar 29 20:48:53 2022 +0200
allocate columns in ScTable::Compare() This gets triggered by ScCellRangeObj::testSortOOB() if INITIALCOLCOUNT is set to 1. Change-Id: I4d9715e89403072b312c0002a43c67ac59960d1a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132281 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 37bdc900dca2..fa47526f3f0f 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -1734,6 +1734,7 @@ short ScTable::Compare(SCCOLROW nIndex1, SCCOLROW nIndex2) const do { SCCOL nCol = static_cast<SCCOL>(aSortParam.maKeyState[nSort].nField); + CreateColumnIfNotExists(nCol); ScRefCellValue aCell1 = aCol[nCol].GetCellValue(nIndex1); ScRefCellValue aCell2 = aCol[nCol].GetCellValue(nIndex2); nRes = CompareCell(nSort, aCell1, nCol, nIndex1, aCell2, nCol, nIndex2); @@ -1741,6 +1742,7 @@ short ScTable::Compare(SCCOLROW nIndex1, SCCOLROW nIndex2) const } else { + CreateColumnIfNotExists(std::max(nIndex1, nIndex2)); do { SCROW nRow = aSortParam.maKeyState[nSort].nField;