diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-12-07 11:26:04 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-12-07 13:17:36 +0000 |
commit | 364b63ff4ed9410524fa2785c73bb58108fd6c06 (patch) | |
tree | 1e382eafd8fb9dd8a82ede9dc4667104310ee491 /sw/source | |
parent | 82afcf2d945f5e2465c82bc846440bc12909e9f8 (diff) |
ofz#54093 Null-dereference
Change-Id: I00b3762d9f8a17ed51db397a5d2ccc88c3c7fcf5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143772
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/filter/html/htmltab.cxx | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index c8fee89794cc..fe55cec381ac 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -5076,24 +5076,27 @@ std::shared_ptr<HTMLTable> SwHTMLParser::BuildTable(SvxAdjust eParentAdjust, OSL_ENSURE( pTableStNd == m_pPam->GetPointNode().FindTableNode(), "Are we in the wrong table?" ); - SwNode* pNd; - if( bTop ) - pNd = pTableStNd; - else - pNd = pTableStNd->EndOfSectionNode(); - SwNodeIndex aDstIdx( *pNd, bTop ? 0 : 1 ); - - m_xDoc->getIDocumentContentOperations().MoveNodeRange( aSrcRg, aDstIdx.GetNode(), - SwMoveFlags::DEFAULT ); - - // If the caption was added before the table, a page style on that table - // needs to be moved to the first paragraph of the header. - // Additionally, all remembered indices that point to the table node - // need to be moved - if( bTop ) + if (pTableStNd) { - MovePageDescAttrs( pTableStNd, aSrcRg.aStart.GetIndex(), - false ); + SwNode* pNd; + if( bTop ) + pNd = pTableStNd; + else + pNd = pTableStNd->EndOfSectionNode(); + SwNodeIndex aDstIdx( *pNd, bTop ? 0 : 1 ); + + m_xDoc->getIDocumentContentOperations().MoveNodeRange( aSrcRg, aDstIdx.GetNode(), + SwMoveFlags::DEFAULT ); + + // If the caption was added before the table, a page style on that table + // needs to be moved to the first paragraph of the header. + // Additionally, all remembered indices that point to the table node + // need to be moved + if( bTop ) + { + MovePageDescAttrs( pTableStNd, aSrcRg.aStart.GetIndex(), + false ); + } } } |