diff options
author | Caolán McNamara <caolanm@redhat.com> | 2023-01-21 16:20:29 +0000 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-01-25 08:56:28 +0000 |
commit | 019d80b59e555747b6d17dfc938e5e4b31be6482 (patch) | |
tree | c982df519b987f7d3b3582d561a9fae4e14964ac | |
parent | comphelper: check for nullptr (diff) | |
download | core-019d80b59e555747b6d17dfc938e5e4b31be6482.tar.gz core-019d80b59e555747b6d17dfc938e5e4b31be6482.zip |
rhbz#2162862 null pFrame during teardown
Change-Id: Iad2de93f0400b0ec49dae4c3d6979957784114f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145935
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
(cherry picked from commit 2e3b1a683f490384bedd925cb57dc9bc9f5c6cf1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145952
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r-- | sw/source/core/access/accpara.cxx | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index aea0d2b3518f..8121d1c62389 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -431,15 +431,18 @@ bool SwAccessibleParagraph::HasCursor() void SwAccessibleParagraph::UpdatePortionData() { // obtain the text frame - OSL_ENSURE( GetFrame() != nullptr, "The text frame has vanished!" ); - OSL_ENSURE( GetFrame()->IsTextFrame(), "The text frame has mutated!" ); const SwTextFrame* pFrame = static_cast<const SwTextFrame*>( GetFrame() ); - - // build new portion data - m_pPortionData.reset( new SwAccessiblePortionData( - pFrame, GetMap()->GetShell()->GetViewOptions()) ); - pFrame->VisitPortions( *m_pPortionData ); - + OSL_ENSURE( pFrame != nullptr, "The text frame has vanished!" ); + if (!pFrame) + ClearPortionData(); + else + { + OSL_ENSURE( pFrame->IsTextFrame(), "The text frame has mutated!" ); + // build new portion data + m_pPortionData.reset( new SwAccessiblePortionData( + pFrame, GetMap()->GetShell()->GetViewOptions()) ); + pFrame->VisitPortions( *m_pPortionData ); + } OSL_ENSURE( m_pPortionData != nullptr, "UpdatePortionData() failed" ); } |