Kaydet (Commit) 44f930da authored tarafından Zolnai Tamás's avatar Zolnai Tamás

Avoid some segmentation fault

Set methods handle null pointers

Change-Id: I9a66d13220d42e01aa90842ae189a5cf55fabf90
üst 731f3d98
...@@ -381,6 +381,7 @@ public: ...@@ -381,6 +381,7 @@ public:
const boost::optional<editeng::SvxBorderLine>& GetAbsLeftBorder( const bool bVertLayout ) const; const boost::optional<editeng::SvxBorderLine>& GetAbsLeftBorder( const bool bVertLayout ) const;
bool HasBorder() const; bool HasBorder() const;
void RemoveBorders();
}; };
inline void SwFont::SetColor( const Color& rColor ) inline void SwFont::SetColor( const Color& rColor )
...@@ -835,6 +836,10 @@ inline bool SwFont::HasBorder() const ...@@ -835,6 +836,10 @@ inline bool SwFont::HasBorder() const
return m_aTopBorder || m_aBottomBorder || m_aLeftBorder || m_aRightBorder; return m_aTopBorder || m_aBottomBorder || m_aLeftBorder || m_aRightBorder;
} }
inline void SwFont::RemoveBorders()
{
m_aTopBorder = m_aBottomBorder = m_aLeftBorder = m_aRightBorder = boost::none;
}
/************************************************************************* /*************************************************************************
* class SwUnderlineFont * class SwUnderlineFont
......
...@@ -337,7 +337,7 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet, ...@@ -337,7 +337,7 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet,
delete pBackColor; delete pBackColor;
pBackColor = NULL; pBackColor = NULL;
m_aTopBorder = m_aBottomBorder = m_aRightBorder = m_aLeftBorder = boost::none; RemoveBorders();
if( pAttrSet ) if( pAttrSet )
{ {
...@@ -520,10 +520,10 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet, ...@@ -520,10 +520,10 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet,
if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_BOX, if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_BOX,
sal_True, &pItem )) sal_True, &pItem ))
{ {
m_aTopBorder = *((SvxBoxItem*)pItem)->GetTop(); SetTopBorder(((SvxBoxItem*)pItem)->GetTop());
m_aBottomBorder = *((SvxBoxItem*)pItem)->GetBottom(); SetBottomBorder(((SvxBoxItem*)pItem)->GetBottom());
m_aRightBorder = *((SvxBoxItem*)pItem)->GetRight(); SetRightBorder(((SvxBoxItem*)pItem)->GetRight());
m_aLeftBorder = *((SvxBoxItem*)pItem)->GetLeft(); SetLeftBorder(((SvxBoxItem*)pItem)->GetLeft());
} }
const SfxPoolItem* pTwoLinesItem = 0; const SfxPoolItem* pTwoLinesItem = 0;
if( SFX_ITEM_SET == if( SFX_ITEM_SET ==
...@@ -687,13 +687,13 @@ SwFont::SwFont( const SwAttrSet* pAttrSet, ...@@ -687,13 +687,13 @@ SwFont::SwFont( const SwAttrSet* pAttrSet,
if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_BOX, if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_BOX,
sal_True, &pItem )) sal_True, &pItem ))
{ {
m_aTopBorder = *((SvxBoxItem*)pItem)->GetTop(); SetTopBorder(((SvxBoxItem*)pItem)->GetTop());
m_aBottomBorder = *((SvxBoxItem*)pItem)->GetBottom(); SetBottomBorder(((SvxBoxItem*)pItem)->GetBottom());
m_aRightBorder = *((SvxBoxItem*)pItem)->GetRight(); SetRightBorder(((SvxBoxItem*)pItem)->GetRight());
m_aLeftBorder = *((SvxBoxItem*)pItem)->GetLeft(); SetLeftBorder(((SvxBoxItem*)pItem)->GetLeft());
} }
else else
m_aTopBorder = m_aBottomBorder = m_aRightBorder = m_aLeftBorder = boost::none; RemoveBorders();
const SvxTwoLinesItem& rTwoLinesItem = pAttrSet->Get2Lines(); const SvxTwoLinesItem& rTwoLinesItem = pAttrSet->Get2Lines();
if ( ! rTwoLinesItem.GetValue() ) if ( ! rTwoLinesItem.GetValue() )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment