summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-10-10 11:28:08 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-10-10 12:50:23 +0100
commit7d746fe50b991a51527aabbadd152ec705c683b3 (patch)
tree95a8bc41a4c02ad10e76742cf08cb4dd2ce68863
parent353ef256b1a09ec431c3397c9ed8e232b713765d (diff)
coverity#704901 Dereference after null check
Change-Id: I6a44577d7520a8faebdf3a6e8de1c91a6e465bac
-rw-r--r--sw/source/core/layout/fly.cxx16
1 files changed, 12 insertions, 4 deletions
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 9299a2120abd..d0b8975ebda4 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -858,11 +858,19 @@ void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
}
SwFmtURL aURL( GetFmt()->GetURL() );
- if ( aURL.GetMap() )
+
+ SwFmtFrmSize *pNewFmtFrmSize = NULL;
+ SwFmtChg *pOldFmtChg = NULL;
+ if (nWhich == RES_FRM_SIZE)
+ pNewFmtFrmSize = (SwFmtFrmSize*)pNew;
+ else
+ pOldFmtChg = (SwFmtChg*)pOld;
+
+ if (aURL.GetMap() && (pNewFmtFrmSize || pOldFmtChg))
{
- const SwFmtFrmSize &rOld = nWhich == RES_FRM_SIZE ?
- *(SwFmtFrmSize*)pNew :
- ((SwFmtChg*)pOld)->pChangedFmt->GetFrmSize();
+ const SwFmtFrmSize &rOld = pNewFmtFrmSize ?
+ *pNewFmtFrmSize :
+ pOldFmtChg->pChangedFmt->GetFrmSize();
//#35091# Can be "times zero", when loading the template
if ( rOld.GetWidth() && rOld.GetHeight() )
{