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

New commits:
commit 05d8be5c4a13be63cfbea58954f1b0c4d8a9837f
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri May 19 16:12:18 2023 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed May 24 11:10:00 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
    (cherry picked from commit 77bc0d1d7c0b895d089fa7ac2f7ca5221345b71a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152102

diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx 
b/sw/source/core/doc/DocumentLayoutManager.cxx
index e0366bdd3a0b..75c8e86acdb2 100644
--- a/sw/source/core/doc/DocumentLayoutManager.cxx
+++ b/sw/source/core/doc/DocumentLayoutManager.cxx
@@ -454,8 +454,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