sw/source/core/doc/DocumentLayoutManager.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 0916808ed8f39604bc105cd74200090a409e8618
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri May 19 16:12:18 2023 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue May 23 12:45:45 2023 +0200

    sw: fix crash in DocumentLayoutManager::CopyLayoutFormat
    
    See 
https://crashreport.libreoffice.org/stats/signature/sw::DocumentLayoutManager::CopyLayoutFormat(SwFrameFormat%20const%20&,SwFormatAnchor%20const%20&,bool,bool)
    
    Change-Id: I1680bb79be4c1eb2ff18ed46dfa286da5e729e63
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152015
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Tested-by: Jenkins

diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx 
b/sw/source/core/doc/DocumentLayoutManager.cxx
index 6959b7c7ba3a..6481f104c737 100644
--- a/sw/source/core/doc/DocumentLayoutManager.cxx
+++ b/sw/source/core/doc/DocumentLayoutManager.cxx
@@ -453,8 +453,9 @@ SwFrameFormat *DocumentLayoutManager::CopyLayoutFormat(
     {
         SwNode* pAnchorNode = rNewAnchor.GetAnchorNode();
         SwFormatFlyCnt aFormat( pDest );
-        pAnchorNode->GetTextNode()->InsertItem(
-            aFormat, rNewAnchor.GetAnchorContentOffset(), 0 );
+        assert(pAnchorNode->GetTextNode() && "sw.core: text node expected");
+        if (SwTextNode *pTextNd = pAnchorNode->GetTextNode())
+            pTextNd->InsertItem( aFormat, rNewAnchor.GetAnchorContentOffset(), 
0 );
     }
 
     if( bMakeFrames )

Reply via email to