sw/source/filter/html/htmltab.cxx | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
New commits: commit 9b26a2ea8e7968d344ae8da12b314464e282c009 Author: Caolán McNamara <[email protected]> Date: Wed Dec 13 13:41:15 2017 +0000 ofz: various html problems Change-Id: Ie29a560c14e535e9a894212e5ed577f94a9064e7 Reviewed-on: https://gerrit.libreoffice.org/46409 Tested-by: Jenkins <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index 7296cd860348..6810a222c742 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -1190,8 +1190,13 @@ const SwStartNode* HTMLTable::GetPrevBoxStartNode( sal_uInt16 nRow, sal_uInt16 n while( pPrevCnts->Next() ) pPrevCnts = pPrevCnts->Next(); - return ( pPrevCnts->GetStartNode() ? pPrevCnts->GetStartNode() - : pPrevCnts->GetTable()->GetPrevBoxStartNode( USHRT_MAX, USHRT_MAX ) ); + const SwStartNode* pRet = pPrevCnts->GetStartNode(); + if (pRet) + return pRet; + HTMLTable* pTable = pPrevCnts->GetTable().get(); + if (!pTable) + return nullptr; + return pTable->GetPrevBoxStartNode(USHRT_MAX, USHRT_MAX); } static bool IsBoxEmpty( const SwTableBox *pBox ) @@ -2658,7 +2663,7 @@ const SwStartNode *SwHTMLParser::InsertTableSection pStNd = pNd->FindTableBoxStartNode(); m_xTable->m_bFirstCell = false; } - else + else if (pPrevStNd) { const SwNode* pNd; if( pPrevStNd->IsTableNode() ) @@ -2670,6 +2675,11 @@ const SwStartNode *SwHTMLParser::InsertTableSection pColl ); m_xTable->IncBoxCount(); } + else + { + eState = SvParserState::Error; + return nullptr; + } //Added defaults to CJK and CTL SwContentNode *pCNd = m_xDoc->GetNodes()[pStNd->GetIndex()+1] ->GetContentNode(); @@ -5106,6 +5116,8 @@ std::shared_ptr<HTMLTable> SwHTMLParser::BuildTable(SvxAdjust eParentAdjust, while( m_aContexts.size() > m_nContextStAttrMin ) { std::unique_ptr<HTMLAttrContext> xCntxt(PopContext()); + if (!xCntxt) + break; ClearContext(xCntxt.get()); } commit ed8dd7f47793b8ef3cc76ce4cde4d7348b51baad Author: Caolán McNamara <[email protected]> Date: Wed Dec 13 20:22:11 2017 +0000 ofz: skip tables when parser is invalid Change-Id: I8edc57be479ecd787fbf23b9e79fb81e47bab1d0 Reviewed-on: https://gerrit.libreoffice.org/46424 Tested-by: Jenkins <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index d0dd6dfd22de..7296cd860348 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -5112,7 +5112,7 @@ std::shared_ptr<HTMLTable> SwHTMLParser::BuildTable(SvxAdjust eParentAdjust, m_nContextStMin = pTCntxt->GetContextStMin(); m_nContextStAttrMin = pTCntxt->GetContextStAttrMin(); - if (m_xTable == xCurTable) + if (m_xTable == xCurTable && eState != SvParserState::Error) { // Set table caption const SwStartNode *pCapStNd = m_xTable->GetCaptionStartNode(); @@ -5171,7 +5171,7 @@ std::shared_ptr<HTMLTable> SwHTMLParser::BuildTable(SvxAdjust eParentAdjust, pTCntxt->RestorePREListingXMP( *this ); RestoreAttrTab( pTCntxt->aAttrTab ); - if (m_xTable == xCurTable) + if (m_xTable == xCurTable && eState != SvParserState::Error) { // Set upper paragraph spacing m_bUpperSpace = true;
_______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
