diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-09-01 09:39:37 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-09-01 10:40:14 +0100 |
commit | ba401ee10be2fb051bc961680f35b04e4e77a32d (patch) | |
tree | f4ff4d12ad19652eb191fce17155cf5902b13de3 | |
parent | ac192a7ef116e6453fee7872b558ff957e377c50 (diff) |
coverity#1372378 Dereference null return value
Change-Id: I4f5c6b79d884497574dee37a15752178c1eb59ed
-rw-r--r-- | sw/source/core/frmedt/fefly1.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/frmedt/fews.cxx | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 782400a8d2d0..d05c562cd5f5 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -1040,8 +1040,8 @@ bool SwFEShell::SetFlyFrameAttr( SfxItemSet& rSet ) if( rSet.Count() ) { SwFlyFrame *pFly = GetSelectedOrCurrFlyFrame(); - OSL_ENSURE( pFly, "SetFlyFrameAttr, no Fly selected." ); - if( pFly ) + OSL_ENSURE(pFly, "SetFlyFrameAttr, no Fly selected."); + if (pFly) { StartAllAction(); const Point aPt( pFly->Frame().Pos() ); diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx index 630959e1e2ea..9bc6d948c264 100644 --- a/sw/source/core/frmedt/fews.cxx +++ b/sw/source/core/frmedt/fews.cxx @@ -491,9 +491,12 @@ void SwFEShell::InsertLabel( const SwLabelType eType, const OUString &rText, con SfxItemSet aSet(makeItemSetFromFormatAnchor(GetDoc()->GetAttrPool(), aAnc)); SwFlyFrame *pFly = GetSelectedOrCurrFlyFrame(); - SwFlyFrameFormat* pInnerFlyFormat = pFly->GetFormat(); - GetDoc()->SetFlyFrameAttr(*pInnerFlyFormat, aSet); - + OSL_ENSURE(pFly, "SetFlyFrameAttr, no Fly selected."); + if (pFly) + { + SwFlyFrameFormat* pInnerFlyFormat = pFly->GetFormat(); + GetDoc()->SetFlyFrameAttr(*pInnerFlyFormat, aSet); + } //put a hard-break after the graphic to keep it separated //from the caption text if the outer frame is resized SwIndex aIdx(pTextNode, bBefore ? nInsertPos : 1); |