sw/source/core/table/swnewtable.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
New commits: commit 1b4f6c81de2af3b165594654966bcd5b62dc6081 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Tue Feb 11 18:44:28 2020 +0100 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Wed Feb 12 13:08:02 2020 +0100 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.st...@cib.de> 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 _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits