From 2a2b6d3e137c1f23b7bd8a093a228063338f56e9 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 8 Nov 2014 11:55:52 +0000 Subject: coverity#704961 Dereference after null check Change-Id: I6acca68cbebf149f7ac7f18fa0011e7f3d20a957 --- sw/source/core/unocore/unostyle.cxx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'sw') diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 84d71489b8cb..710150628680 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) -- cgit