summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2012-06-12 08:38:11 -0500
committerNorbert Thiebaud <nthiebaud@gmail.com>2012-06-12 08:38:42 -0500
commitd10305bbcf98088ef3d7eeee2299e4a21de6e48f (patch)
tree1555fbcf6a5580143f83995bbcd3d9c6957c156d
parentad68e47b740498a80c5802e1672022221f196c22 (diff)
fix null pointer dereference
Change-Id: Ia117e1db43b29eda2f87bf1b1f26d580006e4b8b
-rw-r--r--sw/source/core/draw/dcontact.cxx14
1 files changed, 12 insertions, 2 deletions
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 998b1672ba83..a2e8e04dd6a2 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -1320,6 +1320,13 @@ void SwDrawContact::_Changed( const SdrObject& rObj,
// get instance <SwAnchoredDrawObject> only once
const SwAnchoredDrawObject* pAnchoredDrawObj =
static_cast<const SwAnchoredDrawObject*>( GetAnchoredObj( &rObj ) );
+
+ /* protect against NULL pointer dereferencing */
+ if(!pAnchoredDrawObj)
+ {
+ break;
+ }
+
// OD 2004-04-06 #i26791# - adjust positioning and alignment attributes,
// if positioning of drawing object isn't in progress.
// #i53320# - no adjust of positioning attributes,
@@ -1432,8 +1439,11 @@ void SwDrawContact::_Changed( const SdrObject& rObj,
// of as-character anchored object
if ( bAnchoredAsChar )
{
- const_cast<SwAnchoredDrawObject*>(pAnchoredDrawObj)
- ->AnchorFrm()->Prepare( PREP_FLY_ATTR_CHG, GetFmt() );
+ SwFrm* pAnchorFrm = const_cast<SwAnchoredDrawObject*>(pAnchoredDrawObj)->AnchorFrm();
+ if(pAnchorFrm)
+ {
+ pAnchorFrm->Prepare( PREP_FLY_ATTR_CHG, GetFmt() );
+ }
}
}
}