diff options
author | Arul <arul71.m@gmail.com> | 2016-01-12 15:35:14 +0530 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-01-12 11:38:31 +0000 |
commit | 293e7bef122fc5f5f4b9cc7719e22489913e8726 (patch) | |
tree | 4fef7d215091c18645eb3fcf4cfad3e44f3a8c8d | |
parent | 39f0277ba71c8f3834579003c046d12fa4650e8f (diff) |
tdf#90606 Crash when delete a large part of a column with shift cells left
skipping splitFormulaCellGroup() and joinFormulaCellAbove() for nEndRow equal
to MAXROW since nEndRow + 1 is not valid
Change-Id: Iabfcb33bf58d20331841ca386cca4a91fd6598bf
Reviewed-on: https://gerrit.libreoffice.org/21389
Reviewed-by: jan iversen <jani@documentfoundation.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit 975ceab198a06558875006bbd9a4d0a2708e416e)
Reviewed-on: https://gerrit.libreoffice.org/21393
-rw-r--r-- | sc/source/core/data/column.cxx | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 910981af7b39..3a7daf10a657 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1909,14 +1909,20 @@ void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn& rCol) // Split the formula grouping at the top and bottom boundaries. sc::CellStoreType::position_type aPos = maCells.position(nStartRow); sc::SharedFormulaUtil::splitFormulaCellGroup(aPos, nullptr); - aPos = maCells.position(aPos.first, nEndRow+1); - sc::SharedFormulaUtil::splitFormulaCellGroup(aPos, nullptr); + if (ValidRow(nEndRow+1)) + { + aPos = maCells.position(aPos.first, nEndRow+1); + sc::SharedFormulaUtil::splitFormulaCellGroup(aPos, nullptr); + } // Do the same with the destination column. aPos = rCol.maCells.position(nStartRow); sc::SharedFormulaUtil::splitFormulaCellGroup(aPos, nullptr); - aPos = rCol.maCells.position(aPos.first, nEndRow+1); - sc::SharedFormulaUtil::splitFormulaCellGroup(aPos, nullptr); + if (ValidRow(nEndRow+1)) + { + aPos = rCol.maCells.position(aPos.first, nEndRow+1); + sc::SharedFormulaUtil::splitFormulaCellGroup(aPos, nullptr); + } // Move the broadcasters to the destination column. maBroadcasters.transfer(nStartRow, nEndRow, rCol.maBroadcasters, nStartRow); @@ -1930,8 +1936,11 @@ void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn& rCol) // Re-group transferred formula cells. aPos = rCol.maCells.position(nStartRow); sc::SharedFormulaUtil::joinFormulaCellAbove(aPos); - aPos = rCol.maCells.position(aPos.first, nEndRow+1); - sc::SharedFormulaUtil::joinFormulaCellAbove(aPos); + if (ValidRow(nEndRow+1)) + { + aPos = rCol.maCells.position(aPos.first, nEndRow+1); + sc::SharedFormulaUtil::joinFormulaCellAbove(aPos); + } CellStorageModified(); rCol.CellStorageModified(); |