diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-10-14 09:42:43 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-10-14 10:59:43 +0100 |
commit | 2a8559769ed807eb6384d1ea9ceb275d60924337 (patch) | |
tree | 6a4e8d73113985d883b189f1ed68415d5afe38fa /sw | |
parent | 0aca6eb71c148f1c3a72df9c2f6da6d4364106b8 (diff) |
coverity#1326206 Dereference after null check
Change-Id: I187c182a1645cdd38c81bc72b3c836ab21725173
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/layout/frmtool.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/text/txtfly.cxx | 5 |
2 files changed, 6 insertions, 7 deletions
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 1b5e10d7f6bf..bf38170751c8 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -3098,19 +3098,19 @@ const SwFrm* GetVirtualUpper( const SwFrm* pFrm, const Point& rPos ) return pFrm; } -bool Is_Lower_Of( const SwFrm *pCurrFrm, const SdrObject* pObj ) +bool Is_Lower_Of(const SwFrm *pCurrFrm, const SdrObject* pObj) { Point aPos; const SwFrm* pFrm; - if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr ) + if (const SwVirtFlyDrawObj *pFlyDrawObj = dynamic_cast<const SwVirtFlyDrawObj*>(pObj)) { - const SwFlyFrm* pFly = static_cast<const SwVirtFlyDrawObj*>(pObj )->GetFlyFrm(); + const SwFlyFrm* pFly = pFlyDrawObj->GetFlyFrm(); pFrm = pFly->GetAnchorFrm(); aPos = pFly->Frm().Pos(); } else { - pFrm = static_cast<SwDrawContact*>(GetUserCall(pObj) )->GetAnchorFrm(pObj); + pFrm = static_cast<SwDrawContact*>(GetUserCall(pObj))->GetAnchorFrm(pObj); aPos = pObj->GetCurrentBoundRect().TopLeft(); } OSL_ENSURE( pFrm, "8-( Fly is lost in Space." ); diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index da194ae75e94..ff93cced605d 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -665,10 +665,9 @@ bool SwTextFly::GetTop( const SwAnchoredObject* _pAnchoredObj, // #i26945# const SdrObject* pNew = _pAnchoredObj->GetDrawObj(); // #102344# Ignore connectors which have one or more connections - if(pNew && dynamic_cast< const SdrEdgeObj *>( pNew ) != nullptr) + if (const SdrEdgeObj* pEdgeObj = dynamic_cast<const SdrEdgeObj*>(pNew)) { - if(static_cast<const SdrEdgeObj*>(pNew)->GetConnectedNode(true) - || static_cast<const SdrEdgeObj*>(pNew)->GetConnectedNode(false)) + if (pEdgeObj->GetConnectedNode(true) || pEdgeObj->GetConnectedNode(false)) { return false; } |