summaryrefslogtreecommitdiff
path: root/sc/source/core/data/table3.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core/data/table3.cxx')
-rw-r--r--sc/source/core/data/table3.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index b901b1e31a20..7d5d79f2eac7 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -781,8 +781,11 @@ void ScTable::SortReorderByColumn(
sc::CellStoreType& rCells = aCol[nCol].maCells;
sc::CellStoreType::position_type aPos = rCells.position(nRow1);
sc::SharedFormulaUtil::joinFormulaCellAbove(aPos);
- aPos = rCells.position(aPos.first, nRow2+1);
- sc::SharedFormulaUtil::joinFormulaCellAbove(aPos);
+ if (nRow2 < MAXROW)
+ {
+ aPos = rCells.position(aPos.first, nRow2+1);
+ sc::SharedFormulaUtil::joinFormulaCellAbove(aPos);
+ }
}
}