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:
const boost::optional<editeng::SvxBorderLine>& GetAbsLeftBorder( const bool bVertLayout ) const;
bool HasBorder() const;
void RemoveBorders();
};
inline void SwFont::SetColor( const Color& rColor )
......@@ -835,6 +836,10 @@ inline bool SwFont::HasBorder() const
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
......
......@@ -337,7 +337,7 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet,
delete pBackColor;
pBackColor = NULL;
m_aTopBorder = m_aBottomBorder = m_aRightBorder = m_aLeftBorder = boost::none;
RemoveBorders();
if( pAttrSet )
{
......@@ -520,10 +520,10 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet,
if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_BOX,
sal_True, &pItem ))
{
m_aTopBorder = *((SvxBoxItem*)pItem)->GetTop();
m_aBottomBorder = *((SvxBoxItem*)pItem)->GetBottom();
m_aRightBorder = *((SvxBoxItem*)pItem)->GetRight();
m_aLeftBorder = *((SvxBoxItem*)pItem)->GetLeft();
SetTopBorder(((SvxBoxItem*)pItem)->GetTop());
SetBottomBorder(((SvxBoxItem*)pItem)->GetBottom());
SetRightBorder(((SvxBoxItem*)pItem)->GetRight());
SetLeftBorder(((SvxBoxItem*)pItem)->GetLeft());
}
const SfxPoolItem* pTwoLinesItem = 0;
if( SFX_ITEM_SET ==
......@@ -687,13 +687,13 @@ SwFont::SwFont( const SwAttrSet* pAttrSet,
if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_BOX,
sal_True, &pItem ))
{
m_aTopBorder = *((SvxBoxItem*)pItem)->GetTop();
m_aBottomBorder = *((SvxBoxItem*)pItem)->GetBottom();
m_aRightBorder = *((SvxBoxItem*)pItem)->GetRight();
m_aLeftBorder = *((SvxBoxItem*)pItem)->GetLeft();
SetTopBorder(((SvxBoxItem*)pItem)->GetTop());
SetBottomBorder(((SvxBoxItem*)pItem)->GetBottom());
SetRightBorder(((SvxBoxItem*)pItem)->GetRight());
SetLeftBorder(((SvxBoxItem*)pItem)->GetLeft());
}
else
m_aTopBorder = m_aBottomBorder = m_aRightBorder = m_aLeftBorder = boost::none;
RemoveBorders();
const SvxTwoLinesItem& rTwoLinesItem = pAttrSet->Get2Lines();
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