sw/source/core/access/accpara.cxx |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

New commits:
commit d2a7eb1f15013cd06942a47e83eaa4a3298b12f7
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sat Jan 21 16:20:29 2023 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sat Jan 21 20:08:34 2023 +0000

    rhbz#2162862 null pFrame during teardown
    
    Change-Id: Iad2de93f0400b0ec49dae4c3d6979957784114f4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145955
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

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" );
 }
 

Reply via email to