summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2023-05-27 16:17:32 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2023-05-27 22:17:19 +0200
commit20873f073ae4a9478f0a84355f779a2176bd2ec8 (patch)
tree683e8f16e40123b69035d4c1d9c94dc296a031ae /sw/source
parentfc1eb075a5bbddebd3359dae79713af3094bfd38 (diff)
cid#1448540 Dereference null return value
Change-Id: I72fd7c1a38cb870d99ee085f4f511f2fb9d8d7af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152343 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/uibase/uiview/viewtab.cxx19
1 files changed, 11 insertions, 8 deletions
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index 87cac898cf1d..d99e27f7fb58 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -2467,15 +2467,18 @@ void SwView::StateTabWin(SfxItemSet& rSet)
const SwFormatFooter& rFooter = rDesc.GetMaster().GetFooter();
bool bFooterOn = rFooter.IsActive();
rSet.Put( SfxBoolItem(SID_ATTR_PAGE_FOOTER, bFooterOn ) );
- if(bFooterOn)
+ if (bFooterOn)
{
- const SvxLRSpaceItem* rLR = rFooter.GetFooterFormat()->GetAttrSet().GetItem<SvxLRSpaceItem>(SID_ATTR_LRSPACE);
- const SvxULSpaceItem* rUL = rFooter.GetFooterFormat()->GetAttrSet().GetItem<SvxULSpaceItem>(SID_ATTR_ULSPACE);
- SvxLongLRSpaceItem aLR(rLR->GetLeft(), rLR->GetRight(), SID_ATTR_PAGE_FOOTER_LRMARGIN);
- rSet.Put(aLR);
- SvxLongULSpaceItem aUL( rUL->GetUpper(), rUL->GetLower(), SID_ATTR_PAGE_FOOTER_SPACING);
- rSet.Put(aUL);
-
+ if (const SvxLRSpaceItem* rLR = rFooter.GetFooterFormat()->GetAttrSet().GetItem<SvxLRSpaceItem>(SID_ATTR_LRSPACE))
+ {
+ SvxLongLRSpaceItem aLR(rLR->GetLeft(), rLR->GetRight(), SID_ATTR_PAGE_FOOTER_LRMARGIN);
+ rSet.Put(aLR);
+ }
+ if (const SvxULSpaceItem* rUL = rFooter.GetFooterFormat()->GetAttrSet().GetItem<SvxULSpaceItem>(SID_ATTR_ULSPACE))
+ {
+ SvxLongULSpaceItem aUL( rUL->GetUpper(), rUL->GetLower(), SID_ATTR_PAGE_FOOTER_SPACING);
+ rSet.Put(aUL);
+ }
bool bShared = !rDesc.IsFooterShared();
bool bFirst = !rDesc.IsFirstShared(); // FIXME control changes for both header footer - tdf#100287
sal_uInt16 nLayout = (static_cast<int>(bShared)<<1) + static_cast<int>(bFirst);