sw/source/core/unocore/unostyle.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
New commits: commit 40a68926609ceb879b5f58c5f85d41e9e5c6b2cc Author: Caolán McNamara <caol...@redhat.com> Date: Wed Jan 20 09:43:58 2016 +0000 coverity#1349701 Dereference before null check Change-Id: If919191ac4629885c782e5da39be3c1ce7e4e3dd diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 3116838..b50d395 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);
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits