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

Caolán McNamara caolanm at redhat.com
Sat Nov 8 03:58:55 PST 2014


 sw/source/core/unocore/unostyle.cxx |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

New commits:
commit 2a2b6d3e137c1f23b7bd8a093a228063338f56e9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Nov 8 11:55:52 2014 +0000

    coverity#704961 Dereference after null check
    
    Change-Id: I6acca68cbebf149f7ac7f18fa0011e7f3d20a957

diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 84d7148..7101506 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1876,7 +1876,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
                                         break;
                                     }
                                 }
-                                if(!pCharFmt)
+                                if(!pCharFmt && pBasePool)
                                 {
 
                                     SfxStyleSheetBase* pBase;
@@ -2026,14 +2026,17 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
 
                     sal_Int16 nIdx = GetCommandContextIndex( pSeq[i].Name );
 
-                    pBasePool->SetSearchMask( SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL );
                     bool bStyleFound = false;
-                    const SfxStyleSheetBase* pBase = pBasePool->First();
-                    while (pBase && !bStyleFound)
+                    if (pBasePool)
                     {
-                        if(pBase->GetName() == aStyleName)
-                            bStyleFound = true;
-                        pBase = pBasePool->Next();
+                        pBasePool->SetSearchMask( SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL );
+                        const SfxStyleSheetBase* pBase = pBasePool->First();
+                        while (pBase && !bStyleFound)
+                        {
+                            if(pBase->GetName() == aStyleName)
+                                bStyleFound = true;
+                            pBase = pBasePool->Next();
+                        }
                     }
 
                     if (nIdx == -1 || !bStyleFound)


More information about the Libreoffice-commits mailing list