diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-12-24 11:33:49 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-12-25 21:52:29 +0100 |
commit | 2cdbed131584e27ec137e8fd27445d934aad97f8 (patch) | |
tree | 6d9fc660642b4a110465ff812d1fa309d4d71fb3 /sw | |
parent | cc949585d51f5fdbd1a4d5b29c38a03d0c637caa (diff) |
ofz#4735 Null-dereference
Change-Id: I930c6ace947c4516facc36782451303e12dba336
Reviewed-on: https://gerrit.libreoffice.org/47043
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')
-rw-r--r-- | sw/source/filter/html/swhtml.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 1b1cd5c950e8..898d9f58ef8c 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -3688,7 +3688,8 @@ void SwHTMLParser::NewFontAttr( HtmlTokenId nToken ) // In headings the current heading sets the font height // and not BASEFONT. - sal_uInt16 nPoolId = GetCurrFormatColl()->GetPoolFormatId(); + const SwFormatColl *pColl = GetCurrFormatColl(); + sal_uInt16 nPoolId = pColl ? pColl->GetPoolFormatId() : 0; if( nPoolId>=RES_POOLCOLL_HEADLINE1 && nPoolId<=RES_POOLCOLL_HEADLINE6 ) { @@ -4505,7 +4506,7 @@ bool SwHTMLParser::HasCurrentParaFlys( bool bNoSurroundOnly, const SwFormatColl *SwHTMLParser::GetCurrFormatColl() const { const SwContentNode* pCNd = m_pPam->GetContentNode(); - return &pCNd->GetAnyFormatColl(); + return pCNd ? &pCNd->GetAnyFormatColl() : nullptr; } void SwHTMLParser::SetTextCollAttrs( HTMLAttrContext *pContext ) @@ -5286,9 +5287,9 @@ void SwHTMLParser::InsertHorzRule() if( nWidth < MINLAY ) nWidth = MINLAY; - if( (long)nWidth < nBrowseWidth ) + const SwFormatColl *pColl = ((long)nWidth < nBrowseWidth) ? GetCurrFormatColl() : nullptr; + if (pColl) { - const SwFormatColl *pColl = GetCurrFormatColl(); SvxLRSpaceItem aLRItem( pColl->GetLRSpace() ); long nDist = nBrowseWidth - nWidth; |