[Libreoffice-commits] core.git: sw/source

Caolán McNamara caolanm at redhat.com
Mon Dec 25 20:52:54 UTC 2017


 sw/source/filter/html/swhtml.cxx |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 2cdbed131584e27ec137e8fd27445d934aad97f8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Dec 24 11:33:49 2017 +0000

    ofz#4735 Null-dereference
    
    Change-Id: I930c6ace947c4516facc36782451303e12dba336
    Reviewed-on: https://gerrit.libreoffice.org/47043
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

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;
 


More information about the Libreoffice-commits mailing list