[Libreoffice-commits] core.git: sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 9 12:50:51 UTC 2020


 sw/source/uibase/uiview/viewtab.cxx |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

New commits:
commit 539189a56045ae23cfaf2f4aaf20a00117d42dc6
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Jul 9 10:15:35 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Jul 9 14:49:49 2020 +0200

    cid#1448540 Dereference null return value
    
    Change-Id: Ic5692d2bf5be11881792d7dbfb00b11af927b5e4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98416
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index b7f6e02dcc09..33dc8c268a3c 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -2416,14 +2416,17 @@ void SwView::StateTabWin(SfxItemSet& rSet)
             rSet.Put( SfxBoolItem(SID_ATTR_PAGE_HEADER, bHeaderOn ) );
             if(bHeaderOn)
             {
-                const SvxLRSpaceItem* rLR = static_cast<const SvxLRSpaceItem*>(
+                const SvxLRSpaceItem* pLR = static_cast<const SvxLRSpaceItem*>(
                                             rHeader.GetHeaderFormat()->GetAttrSet().GetItem(SID_ATTR_LRSPACE));
-                const SvxULSpaceItem* rUL = static_cast<const SvxULSpaceItem*>(
+                const SvxULSpaceItem* pUL = static_cast<const SvxULSpaceItem*>(
                                             rHeader.GetHeaderFormat()->GetAttrSet().GetItem(SID_ATTR_ULSPACE));
-                SvxLongLRSpaceItem aLR(rLR->GetLeft(), rLR->GetRight(), SID_ATTR_PAGE_HEADER_LRMARGIN);
-                rSet.Put(aLR);
-                SvxLongULSpaceItem aUL( rUL->GetUpper(), rUL->GetLower(), SID_ATTR_PAGE_HEADER_SPACING);
-                rSet.Put(aUL);
+                if (pLR && pUL)
+                {
+                    SvxLongLRSpaceItem aLR(pLR->GetLeft(), pLR->GetRight(), SID_ATTR_PAGE_HEADER_LRMARGIN);
+                    rSet.Put(aLR);
+                    SvxLongULSpaceItem aUL( pUL->GetUpper(), pUL->GetLower(), SID_ATTR_PAGE_HEADER_SPACING);
+                    rSet.Put(aUL);
+                }
 
                 bool bShared = !rDesc.IsHeaderShared();
                 bool bFirst = !rDesc.IsFirstShared(); // FIXME control changes for both header footer - tdf#100287


More information about the Libreoffice-commits mailing list