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

New commits:
commit 8163882de6308e46b261af9e75906d1d05c4eb08
Author:     Patrick Luby <plub...@libreoffice.org>
AuthorDate: Sat Jan 13 17:57:56 2024 -0500
Commit:     Patrick Luby <plub...@libreoffice.org>
CommitDate: Tue Jan 23 01:18:20 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/+/162225

diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 6f122e73b6da..72f1c809e227 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