sw/source/core/doc/doctxm.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 24eb8731513e5a8b0b761cbd0dabd71ea7038c2d
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Apr 3 12:20:42 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sun Apr 3 16:20:14 2022 +0200

    cid#1503360 Dereference null return value
    
    Change-Id: I5c25149a9c2ec2938754de7f79991c93c741e914
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132478
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 828742c0e37c..df997eb34a43 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -935,8 +935,9 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
 
     // find the first layout node for this TOX, if it only find the content
     // in his own chapter
-    const SwTextNode* pOwnChapterNode = IsFromChapter()
-        ? ::lcl_FindChapterNode( *pSectNd, pLayout, 
pSectNd->FindSectionNode()->GetSectionLevel() + 1 )
+    const SwSectionNode* pChapterSectNd = IsFromChapter() ? 
pSectNd->FindSectionNode() : nullptr;
+    const SwTextNode* pOwnChapterNode = pChapterSectNd
+        ? ::lcl_FindChapterNode( *pSectNd, pLayout, 
pChapterSectNd->GetSectionLevel() + 1 )
         : nullptr;
 
     SwNode2LayoutSaveUpperFrames aN2L(*pSectNd);

Reply via email to