summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-03-03 13:58:31 +0000
committerXisco Fauli <xiscofauli@libreoffice.org>2024-03-04 09:46:53 +0100
commitc586333a1824b23b5cbde9416f5858ced0acd7a7 (patch)
tree415c73fd9e1e0b5644bcabba6eb2dabbc2cfb585
parenttdf#159968: Support overflow:visible in marker element (diff)
downloadcore-c586333a1824b23b5cbde9416f5858ced0acd7a7.tar.gz
core-c586333a1824b23b5cbde9416f5858ced0acd7a7.zip
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 <xiscofauli@libreoffice.org>
-rw-r--r--sw/source/core/edit/edsect.cxx8
1 files changed, 6 insertions, 2 deletions
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();
}