sw/source/core/undo/untbl.cxx |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 52e959efc36edaf3e5bd1cd8ad75d4541f861390
Author:     Patrick Luby <plub...@libreoffice.org>
AuthorDate: Sat Jan 13 17:57:56 2024 -0500
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Jan 22 13:11:32 2024 +0100

    tdf#159025 skip undo if SwTableNode is a nullptr
    
    I don't know what causes the SwTableNode to be a nullptr in the
    case of tdf#159025, but at least stop the crashing by skipping
    this undo request.
    
    Change-Id: Idad1ed290af215e591018ea58732b77ca504ba01
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162031
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Reviewed-by: Patrick Luby <plub...@libreoffice.org>
    (cherry picked from commit f414c61f8dd2617baa0851525b8a7a630c5e34da)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162228

diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 3092df0c2fd3..8da85452c7d9 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -272,7 +272,14 @@ void SwUndoInsTable::UndoImpl(::sw::UndoRedoContext & 
rContext)
     SwNodeIndex aIdx( rDoc.GetNodes(), m_nStartNode );
 
     SwTableNode* pTableNd = aIdx.GetNode().GetTableNode();
-    OSL_ENSURE( pTableNd, "no TableNode" );
+    // tdf#159025 skip undo if SwTableNode is a nullptr
+    // I don't know what causes the SwTableNode to be a nullptr in the
+    // case of tdf#159025, but at least stop the crashing by skipping
+    // this undo request.
+    SAL_WARN_IF( !pTableNd, "sw.core", "no TableNode" );
+    if( !pTableNd )
+        return;
+
     pTableNd->DelFrames();
 
     if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() ))

Reply via email to