sw/source/core/doc/DocumentContentOperationsManager.cxx |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit 36a005bb546e5ba68d2e7a57e0453999c7167e41
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Wed Nov 24 12:23:10 2021 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Nov 24 17:43:32 2021 +0100

    tdf#145621 sw: fix crash pasting paragraph with cross-reference mark
    
    At last, a case where copying a mark fails for legitimate reasons.
    
    (regression from 4bf04dea9afb30a9395e80b07a81d1908937ee8b)
    
    Change-Id: I7a318e03c0b0d30e204eadb5012f190edbbba486
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125767
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index f99de3cc390a..5311bfb5e3b8 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -300,6 +300,12 @@ namespace sw
                 ::sw::mark::InsertMode::CopyText);
             // Explicitly try to get exactly the same name as in the source
             // because NavigatorReminders, DdeBookmarks etc. ignore the 
proposed name
+            if (pNewMark == nullptr)
+            {
+                assert(IDocumentMarkAccess::GetType(*pMark) == 
IDocumentMarkAccess::MarkType::CROSSREF_NUMITEM_BOOKMARK
+                    || IDocumentMarkAccess::GetType(*pMark) == 
IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK);
+                continue; // can't insert duplicate cross reference mark
+            }
             rDestDoc.getIDocumentMarkAccess()->renameMark(pNewMark, 
pMark->GetName());
 
             // copying additional attributes for bookmarks or fieldmarks

Reply via email to