summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-07-09 10:08:17 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-07-09 14:47:39 +0200
commite8a86811c59c173b331e521879085beab895e5ce (patch)
treeed4e38b9369c956fca82847ae7d5babc23a2534b /cui
parent4213a0b6929d188d5ec75a6b90e194c2b6ba9d11 (diff)
cid#1465232 Dereference null return value
Change-Id: I221af4bce9c5cadabef0acb27177e5bf91f08cd1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98411 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/tabpages/border.cxx40
1 files changed, 26 insertions, 14 deletions
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index 82f9b6c3e0ab..eb72e3417a42 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -847,35 +847,47 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs )
if (m_aFrameSel.IsBorderEnabled(svx::FrameBorderType::TLBR))
{
sal_uInt16 nBorderDiagId = pPool->GetWhich(SID_ATTR_BORDER_DIAG_TLBR);
- SvxLineItem aLineItem(*static_cast<const SvxLineItem*>(rCoreAttrs->GetItem(nBorderDiagId)));
- aLineItem.SetLine(m_aFrameSel.GetFrameBorderStyle(svx::FrameBorderType::TLBR));
- rCoreAttrs->Put(aLineItem);
- bAttrsChanged = true;
+ if (const SfxPoolItem* pItem = rCoreAttrs->GetItem(nBorderDiagId))
+ {
+ SvxLineItem aLineItem(*static_cast<const SvxLineItem*>(pItem));
+ aLineItem.SetLine(m_aFrameSel.GetFrameBorderStyle(svx::FrameBorderType::TLBR));
+ rCoreAttrs->Put(aLineItem);
+ bAttrsChanged = true;
+ }
}
if (m_aFrameSel.IsBorderEnabled(svx::FrameBorderType::BLTR))
{
sal_uInt16 nBorderDiagId = pPool->GetWhich(SID_ATTR_BORDER_DIAG_BLTR);
- SvxLineItem aLineItem(*static_cast<const SvxLineItem*>(rCoreAttrs->GetItem(nBorderDiagId)));
- aLineItem.SetLine(m_aFrameSel.GetFrameBorderStyle(svx::FrameBorderType::BLTR));
- rCoreAttrs->Put(aLineItem);
- bAttrsChanged = true;
+ if (const SfxPoolItem* pItem = rCoreAttrs->GetItem(nBorderDiagId))
+ {
+ SvxLineItem aLineItem(*static_cast<const SvxLineItem*>(pItem));
+ aLineItem.SetLine(m_aFrameSel.GetFrameBorderStyle(svx::FrameBorderType::BLTR));
+ rCoreAttrs->Put(aLineItem);
+ bAttrsChanged = true;
+ }
}
if (m_xShadowControls && m_xShadowControls->get_value_changed_from_saved())
{
sal_uInt16 nShadowId = pPool->GetWhich(mnShadowSlot);
- const SvxShadowItem& rOldShadowItem = *static_cast<const SvxShadowItem*>(rCoreAttrs->GetItem(nShadowId));
- rCoreAttrs->Put(m_xShadowControls->GetControlValue(rOldShadowItem));
- bAttrsChanged = true;
+ if (const SfxPoolItem* pItem = rCoreAttrs->GetItem(nShadowId))
+ {
+ const SvxShadowItem& rOldShadowItem = *static_cast<const SvxShadowItem*>(pItem);
+ rCoreAttrs->Put(m_xShadowControls->GetControlValue(rOldShadowItem));
+ bAttrsChanged = true;
+ }
}
if (m_xMarginControls && m_xMarginControls->get_value_changed_from_saved())
{
sal_uInt16 nAlignMarginId = pPool->GetWhich(SID_ATTR_ALIGN_MARGIN);
- const SvxMarginItem& rOldMarginItem = *static_cast<const SvxMarginItem*>(rCoreAttrs->GetItem(nAlignMarginId));
- rCoreAttrs->Put(m_xMarginControls->GetControlValue(rOldMarginItem));
- bAttrsChanged = true;
+ if (const SfxPoolItem* pItem = rCoreAttrs->GetItem(nAlignMarginId))
+ {
+ const SvxMarginItem& rOldMarginItem = *static_cast<const SvxMarginItem*>(pItem);
+ rCoreAttrs->Put(m_xMarginControls->GetControlValue(rOldMarginItem));
+ bAttrsChanged = true;
+ }
}
if (m_xMergeAdjacentBordersCB->get_state_changed_from_saved())