sw/source/core/edit/edsect.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
New commits: commit c586333a1824b23b5cbde9416f5858ced0acd7a7 Author: Caolán McNamara <[email protected]> AuthorDate: Sun Mar 3 13:58:31 2024 +0000 Commit: Xisco Fauli <[email protected]> CommitDate: Mon Mar 4 09:46:53 2024 +0100 cid#1592908 Dereference null return value and cid#1592910 Dereference null return value Change-Id: I7524c3e91447f4421083dfda10d3dd1c3a6e482d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164301 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx index 04ed95fa42cb..daaa7296e81e 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 @@ -346,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(); }
