sw/source/core/text/EnhancedPDFExportHelper.cxx | 30 ++++++++++++------------ 1 file changed, 16 insertions(+), 14 deletions(-)
New commits: commit 56fb01f6424544a3531071c8bba7fe83f474674e Author: Caolán McNamara <[email protected]> AuthorDate: Mon Sep 15 21:13:14 2025 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Thu Oct 30 21:51:05 2025 +0100 cid#1665431 Dereference null return value Change-Id: Icba6d8bdc8f07c8125c7c4784f93c19dd7d1bd7f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191000 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> (cherry picked from commit 33f5ab817202b06af061ee3866f3b4013bdbcd27) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193222 Reviewed-by: Michael Stahl <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 214e1c17925e..7e4857f6522c 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -1371,21 +1371,23 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() const SwSection* pSection = static_cast<const SwSectionFrame*>(pFrame)->GetSection(); - // open all parent sections, so that the SEs of sections - // are nested in the same way as their SwSectionNodes - std::vector<SwSection const*> parents; - // iterate only *direct* parents - do not leave table cell! - for (SwSectionNode const* pSectionNode{pSection->GetFormat() - ->GetSectionNode()->StartOfSectionNode()->GetSectionNode()}; - pSectionNode != nullptr; - pSectionNode = pSectionNode->StartOfSectionNode()->GetSectionNode()) + if (SwSectionNode const* pFormatSectionNode = pSection->GetFormat()->GetSectionNode()) { - parents.push_back(&pSectionNode->GetSection()); - } - for (auto it = parents.rbegin(); it != parents.rend(); ++it) - { - // key is the SwSection - see lcl_GetKeyFromFrame() - OpenTagImpl(*it); + // open all parent sections, so that the SEs of sections + // are nested in the same way as their SwSectionNodes + std::vector<SwSection const*> parents; + // iterate only *direct* parents - do not leave table cell! + for (SwSectionNode const* pSectionNode{pFormatSectionNode->StartOfSectionNode()->GetSectionNode()}; + pSectionNode != nullptr; + pSectionNode = pSectionNode->StartOfSectionNode()->GetSectionNode()) + { + parents.push_back(&pSectionNode->GetSection()); + } + for (auto it = parents.rbegin(); it != parents.rend(); ++it) + { + // key is the SwSection - see lcl_GetKeyFromFrame() + OpenTagImpl(*it); + } } FrameTagSet& rFrameTagSet(mpPDFExtOutDevData->GetSwPDFState()->m_FrameTagSet);
