diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2011-10-05 13:31:10 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2011-10-05 18:51:35 -0500 |
commit | 79a1c219d96a197c72d7759157dbf6e765f7655e (patch) | |
tree | cd4cd67eff4d99b1672b3701983c3d1fed397691 | |
parent | c1dffc20499a872f9eb4fc9adfb098475ad3a2d5 (diff) |
defensive code against deferencing NULL pointers
-rw-r--r-- | cui/source/tabpages/backgrnd.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx index 8d27b17701bc..6cf1c726e780 100644 --- a/cui/source/tabpages/backgrnd.cxx +++ b/cui/source/tabpages/backgrnd.cxx @@ -555,21 +555,21 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet& rSet ) if ( rSet.GetItemState( nWhich, sal_False ) >= SFX_ITEM_AVAILABLE ) { pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); - pTableBck_Impl->pCellBrush = new SvxBrushItem(*pBgdAttr); + pTableBck_Impl->pCellBrush = pBgdAttr ? new SvxBrushItem(*pBgdAttr) : NULL; } pTableBck_Impl->nCellWhich = nWhich; if ( rSet.GetItemState( SID_ATTR_BRUSH_ROW, sal_False ) >= SFX_ITEM_AVAILABLE ) { pBgdAttr = (const SvxBrushItem*)&( rSet.Get( SID_ATTR_BRUSH_ROW ) ); - pTableBck_Impl->pRowBrush = new SvxBrushItem(*pBgdAttr); + pTableBck_Impl->pRowBrush = pBgdAttr ? new SvxBrushItem(*pBgdAttr) : NULL; } pTableBck_Impl->nRowWhich = SID_ATTR_BRUSH_ROW; if ( rSet.GetItemState( SID_ATTR_BRUSH_TABLE, sal_False ) >= SFX_ITEM_AVAILABLE ) { pBgdAttr = (const SvxBrushItem*)&( rSet.Get( SID_ATTR_BRUSH_TABLE ) ); - pTableBck_Impl->pTableBrush = new SvxBrushItem(*pBgdAttr); + pTableBck_Impl->pTableBrush = pBgdAttr ? new SvxBrushItem(*pBgdAttr) : NULL; } pTableBck_Impl->nTableWhich = SID_ATTR_BRUSH_TABLE; @@ -594,7 +594,7 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet& rSet ) if ( rSet.GetItemState( nWhich, sal_False ) >= SFX_ITEM_AVAILABLE ) { pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); - pParaBck_Impl->pParaBrush = new SvxBrushItem(*pBgdAttr); + pParaBck_Impl->pParaBrush = pBgdAttr ? new SvxBrushItem(*pBgdAttr) : NULL; } nWhich = GetWhich( SID_ATTR_BRUSH_CHAR ); @@ -603,7 +603,7 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet& rSet ) if ( rSet.GetItemState( nWhich, sal_True ) > SFX_ITEM_AVAILABLE ) { pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); - pParaBck_Impl->pCharBrush = new SvxBrushItem(*pBgdAttr); + pParaBck_Impl->pCharBrush = pBgdAttr ? new SvxBrushItem(*pBgdAttr) : NULL; } else pParaBck_Impl->pCharBrush = new SvxBrushItem(SID_ATTR_BRUSH_CHAR); |