cui/source/tabpages/border.cxx |   40 ++++++++++++++++++++++++++--------------
 1 file changed, 26 insertions(+), 14 deletions(-)

New commits:
commit e8a86811c59c173b331e521879085beab895e5ce
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Jul 9 10:08:17 2020 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Jul 9 14:47:39 2020 +0200

    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 <caol...@redhat.com>

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())
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to