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

New commits:
commit d66e7ad9c66c979135cc648e649456792c3fb1ee
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sat Aug 9 16:04:38 2025 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Aug 11 12:09:03 2025 +0200

    cid#1660818 Dereference null return value
    
    Change-Id: Iee0004db9ad48e8753c5570fe6c8ebc31b98fd1c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189263
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit 39f512b4e384b39730a637392ff48897eee21331)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189291
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
index f5af17b48933..49698290666d 100644
--- a/sw/source/core/edit/edsect.cxx
+++ b/sw/source/core/edit/edsect.cxx
@@ -338,7 +338,7 @@ static const SwNode* lcl_SpecialInsertNode(const 
SwPosition* pCurrentPos)
     }
     if(pInnermostNode != nullptr)
     {
-        bool bIsProtected = pInnermostNode->IsProtect();
+        bool bCanModify = !pInnermostNode->IsProtect();
 
         //special case - ToxSection
         // - in this case the inner section could be tox header
@@ -354,7 +354,7 @@ static const SwNode* lcl_SpecialInsertNode(const 
SwPosition* pCurrentPos)
                 if (const SwSection* pSectionParent = pSection->GetParent())
                     pInnermostNode = 
pSectionParent->GetFormat()->GetSectionNode();
             }
-            bIsProtected = static_cast<const 
SwSectionNode*>(pInnermostNode)->IsInProtectSect();
+            bCanModify = pInnermostNode && !static_cast<const 
SwSectionNode*>(pInnermostNode)->IsInProtectSect();
         }
 
         // The previous version had a check to skip empty read-only sections. 
Those
@@ -362,7 +362,7 @@ static const SwNode* lcl_SpecialInsertNode(const 
SwPosition* pCurrentPos)
         // inside a protected area.
 
         // Now, pInnermostNode is NULL or the innermost section or table node.
-        if(!bIsProtected)
+        if (bCanModify)
         {
             OSL_ENSURE( pInnermostNode->IsTableNode() ||
                         pInnermostNode->IsSectionNode(), "wrong node found" );

Reply via email to