summaryrefslogtreecommitdiff
path: root/sw/source/filter/html/htmltab.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-12-13 12:46:34 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-12-14 11:06:45 +0100
commit5399998c498bd3047ecb430868d3aa0cde61fef2 (patch)
tree042999af0be684589941ee2c5e6d882968d6e2a3 /sw/source/filter/html/htmltab.cxx
parenta5c201790bac259da6666543852c8734ed4a9132 (diff)
fiddle with leaks some more
Change-Id: Ia4297ce2b537953fe2262b645b7bf7f8a85b5d41 Reviewed-on: https://gerrit.libreoffice.org/46408 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/filter/html/htmltab.cxx')
-rw-r--r--sw/source/filter/html/htmltab.cxx35
1 files changed, 22 insertions, 13 deletions
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 80d0d883d8e8..d0dd6dfd22de 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -1673,9 +1673,9 @@ SwTableBox *HTMLTable::MakeTableBox( SwTableLine *pUpper,
pBox = NewTableBox( pCnts->GetStartNode(), pUpper );
pCnts->SetTableBox( pBox );
}
- else
+ else if (HTMLTable* pTable = pCnts->GetTable().get())
{
- pCnts->GetTable()->InheritVertBorders( this, nLeftCol,
+ pTable->InheritVertBorders( this, nLeftCol,
nRightCol-nLeftCol );
// ... that's a table. We'll build a new box and put the rows of the table
// in the rows of the box
@@ -1688,6 +1688,10 @@ SwTableBox *HTMLTable::MakeTableBox( SwTableLine *pUpper,
pCnts->GetTable()->MakeTable( pBox, nAbs, nRel, nLSpace, nRSpace,
nInhSpace );
}
+ else
+ {
+ return nullptr;
+ }
}
else
{
@@ -2707,7 +2711,7 @@ const SwStartNode *SwHTMLParser::InsertTableSection( sal_uInt16 nPoolId )
if (!pTableNd)
{
eState = SvParserState::Error;
- throw std::runtime_error("missing table");
+ return nullptr;
}
if( pTableNd->GetTable().GetHTMLTableLayout() )
{ // if there is already a HTMTableLayout, this table is already finished
@@ -2731,7 +2735,6 @@ const SwStartNode *SwHTMLParser::InsertTableSection( sal_uInt16 nPoolId )
if (!pStNd)
{
eState = SvParserState::Error;
- throw std::runtime_error("missing table start node");
}
return pStNd;
@@ -3900,15 +3903,21 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
InsertTableSection( static_cast< sal_uInt16 >(xSaveStruct->IsHeaderCell()
? RES_POOLCOLL_TABLE_HDLN
: RES_POOLCOLL_TABLE ));
- const SwEndNode *pEndNd = pStNd->EndOfSectionNode();
- SwContentNode *pCNd = m_xDoc->GetNodes()[pEndNd->GetIndex()-1] ->GetContentNode();
- //Added defaults to CJK and CTL
- SvxFontHeightItem aFontHeight( 40, 100, RES_CHRATR_FONTSIZE );
- pCNd->SetAttr( aFontHeight );
- SvxFontHeightItem aFontHeightCJK( 40, 100, RES_CHRATR_CJK_FONTSIZE );
- pCNd->SetAttr( aFontHeightCJK );
- SvxFontHeightItem aFontHeightCTL( 40, 100, RES_CHRATR_CTL_FONTSIZE );
- pCNd->SetAttr( aFontHeightCTL );
+
+ if (!pStNd)
+ eState = SvParserState::Error;
+ else
+ {
+ const SwEndNode *pEndNd = pStNd->EndOfSectionNode();
+ SwContentNode *pCNd = m_xDoc->GetNodes()[pEndNd->GetIndex()-1] ->GetContentNode();
+ //Added defaults to CJK and CTL
+ SvxFontHeightItem aFontHeight( 40, 100, RES_CHRATR_FONTSIZE );
+ pCNd->SetAttr( aFontHeight );
+ SvxFontHeightItem aFontHeightCJK( 40, 100, RES_CHRATR_CJK_FONTSIZE );
+ pCNd->SetAttr( aFontHeightCJK );
+ SvxFontHeightItem aFontHeightCTL( 40, 100, RES_CHRATR_CTL_FONTSIZE );
+ pCNd->SetAttr( aFontHeightCTL );
+ }
xSaveStruct->AddContents( new HTMLTableCnts(pStNd) );
xSaveStruct->ClearIsInSection();