diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2020-02-11 18:44:28 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2020-02-12 13:08:02 +0100 |
commit | 1b4f6c81de2af3b165594654966bcd5b62dc6081 (patch) | |
tree | 3235991138fb7a4a048f70accd2778c4ab167cf3 /sw/source | |
parent | 086e43148059a7ebc6caa416fa82bb60fd2cc92f (diff) |
ofz#20455 sw: add some checks in SwTable::CheckConsistency()
Check consistency of number of boxes in SwTable and nodes.
Change-Id: I617f99282b900b17a65ecd18fdd8e8f8860896db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88471
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/table/swnewtable.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx index 78d0525e553c..fb5f7cb5b9a3 100644 --- a/sw/source/core/table/swnewtable.cxx +++ b/sw/source/core/table/swnewtable.cxx @@ -2111,6 +2111,8 @@ void SwTable::CheckConsistency() const SwTwips nLineWidth = 0; std::list< RowSpanCheck > aRowSpanCells; std::list< RowSpanCheck >::iterator aIter = aRowSpanCells.end(); + SwNodeIndex index(*GetTableNode()); + ++index; for( size_t nCurrLine = 0; nCurrLine < nLineCount; ++nCurrLine ) { SwTwips nWidth = 0; @@ -2121,7 +2123,11 @@ void SwTable::CheckConsistency() const for( size_t nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol ) { SwTableBox* pBox = pLine->GetTabBoxes()[nCurrCol]; - SAL_WARN_IF( !pBox, "sw.core", "Missing Table Box" ); + assert(pBox); + SAL_WARN_IF(GetTableNode()->EndOfSectionIndex() <= index.GetIndex(), "sw.core", "Box not in table nodes"); + SAL_WARN_IF(!index.GetNode().IsStartNode(), "sw.core", "No box start node"); + index = *index.GetNode().EndOfSectionNode(); + ++index; SwTwips nNewWidth = pBox->GetFrameFormat()->GetFrameSize().GetWidth() + nWidth; long nRowSp = pBox->getRowSpan(); if( nRowSp < 0 ) @@ -2170,6 +2176,7 @@ void SwTable::CheckConsistency() const } bool bEmpty = aRowSpanCells.empty(); SAL_WARN_IF( !bEmpty, "sw.core", "Open row span detected" ); + SAL_WARN_IF(GetTableNode()->EndOfSectionNode() != &index.GetNode(), "sw.core", "table end node not found"); } #endif |