diff options
-rw-r--r-- | sc/source/core/data/column4.cxx | 7 | ||||
-rw-r--r-- | sc/source/core/data/table3.cxx | 7 |
2 files changed, 11 insertions, 3 deletions
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx index d1aacddf4adb..8b46e74831ab 100644 --- a/sc/source/core/data/column4.cxx +++ b/sc/source/core/data/column4.cxx @@ -499,11 +499,16 @@ public: void ScColumn::SplitFormulaGroupByRelativeRef( const ScRange& rBoundRange ) { + if (rBoundRange.aStart.Row() >= MAXROW) + // Nothing to split. + return; + std::vector<SCROW> aBounds; // Cut at row boundaries first. aBounds.push_back(rBoundRange.aStart.Row()); - aBounds.push_back(rBoundRange.aEnd.Row()+1); + if (rBoundRange.aEnd.Row() < MAXROW) + aBounds.push_back(rBoundRange.aEnd.Row()+1); sc::SharedFormulaUtil::splitFormulaCellGroups(maCells, aBounds); RelativeRefBoundChecker aFunc(rBoundRange); diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index c1a81e6c790b..946416da19fe 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -771,8 +771,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); + } } } |