summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-03-29 19:59:01 +0200
committerLuboš Luňák <l.lunak@collabora.com>2022-03-29 20:48:53 +0200
commitdde866578eff5eaf1d59c5a98d3e72ce87718b00 (patch)
treeddb53dfc16bd04c8896452a177a926cd13a470c3 /sc
parent9333e50be8919ce70234bba2f8496523d90670f5 (diff)
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.lunak@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/table3.cxx2
1 files changed, 2 insertions, 0 deletions
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;