summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-01-20 09:43:58 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-01-20 09:43:58 +0000
commit40a68926609ceb879b5f58c5f85d41e9e5c6b2cc (patch)
tree6a4f0813a5186426d6e06a3ab6d605925a14a8b9 /sw
parenteeae9b08c53a35e2b0252ffbdd0d2f45a7573ee3 (diff)
coverity#1349701 Dereference before null check
Change-Id: If919191ac4629885c782e5da39be3c1ce7e4e3dd
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/unocore/unostyle.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 31168388f274..b50d3954aeb8 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1693,14 +1693,18 @@ void SwXStyle::SetPropertyValue<FN_UNO_PARA_STYLE_CONDITIONS>(const SfxItemPrope
// check for correct context and style name
const auto nIdx(GetCommandContextIndex(rNamedValue.Name));
- if(nIdx == -1)
+ if (nIdx == -1)
throw lang::IllegalArgumentException();
m_pBasePool->SetSearchMask(SFX_STYLE_FAMILY_PARA);
- for(auto pBase = m_pBasePool->First(); pBase->GetName() != aStyleName; pBase = m_pBasePool->Next())
+ bool bStyleFound = false;
+ for(auto pBase = m_pBasePool->First(); pBase; pBase = m_pBasePool->Next())
{
- if(!pBase)
- throw lang::IllegalArgumentException();
+ bStyleFound = pBase->GetName() == aStyleName;
+ if (bStyleFound)
+ break;
}
+ if (!bStyleFound)
+ throw lang::IllegalArgumentException();
aCondItem.SetStyle(&aStyleName, nIdx);
}
o_rStyleBase.GetItemSet().Put(aCondItem);