From d10305bbcf98088ef3d7eeee2299e4a21de6e48f Mon Sep 17 00:00:00 2001 From: Norbert Thiebaud Date: Tue, 12 Jun 2012 08:38:11 -0500 Subject: fix null pointer dereference Change-Id: Ia117e1db43b29eda2f87bf1b1f26d580006e4b8b --- sw/source/core/draw/dcontact.cxx | 14 ++++++++++++-- 1 file 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 only once const SwAnchoredDrawObject* pAnchoredDrawObj = static_cast( 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(pAnchoredDrawObj) - ->AnchorFrm()->Prepare( PREP_FLY_ATTR_CHG, GetFmt() ); + SwFrm* pAnchorFrm = const_cast(pAnchoredDrawObj)->AnchorFrm(); + if(pAnchorFrm) + { + pAnchorFrm->Prepare( PREP_FLY_ATTR_CHG, GetFmt() ); + } } } } -- cgit