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.grandin@collabora.co.uk>
Reviewed-by: Patrick Luby <plubius@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 6f122e7..72f1c80 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() ))