sw/source/core/edit/edsect.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit dd34277a264d11a804688a100c016e09aa8f3181
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sun Mar 3 14:01:53 2024 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Sun Mar 3 20:43:18 2024 +0100

    cid#1592910 Dereference null return value
    
    Change-Id: I7524c3e91447f4421083dfda10d3dd1c3a6e482d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164300
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
index 293c3eef143b..daaa7296e81e 100644
--- a/sw/source/core/edit/edsect.cxx
+++ b/sw/source/core/edit/edsect.cxx
@@ -347,7 +347,10 @@ static const SwNode* lcl_SpecialInsertNode(const 
SwPosition* pCurrentPos)
              SectionType::ToxContent == pSection->GetType()))
         {
             if (SectionType::ToxHeader == pSection->GetType())
-                pInnermostNode = 
pSection->GetParent()->GetFormat()->GetSectionNode();
+            {
+                if (const SwSection* pSectionParent = pSection->GetParent())
+                    pInnermostNode = 
pSectionParent->GetFormat()->GetSectionNode();
+            }
             bIsProtected = static_cast<const 
SwSectionNode*>(pInnermostNode)->IsInProtectSect();
         }
 
commit 0fc4fcf1dff53f6c04481b31071af0e4918b563a
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sun Mar 3 13:58:31 2024 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Sun Mar 3 20:43:08 2024 +0100

    cid#1592908 Dereference null return value
    
    Change-Id: Ic729d455047f31983425b3483deeb8d7448f5cd3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164299
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
index 04ed95fa42cb..293c3eef143b 100644
--- a/sw/source/core/edit/edsect.cxx
+++ b/sw/source/core/edit/edsect.cxx
@@ -333,9 +333,10 @@ static const SwNode* lcl_SpecialInsertNode(const 
SwPosition* pCurrentPos)
                 pInnermostNode = pTableNode;
         }
     }
-    bool bIsProtected = pInnermostNode->IsProtect();
     if(pInnermostNode != nullptr)
     {
+        bool bIsProtected = pInnermostNode->IsProtect();
+
         //special case - ToxSection
         // - in this case the inner section could be tox header
         //   section but the new node should be before the content section

Reply via email to