diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2021-11-24 12:23:10 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2021-11-24 17:43:32 +0100 |
commit | 36a005bb546e5ba68d2e7a57e0453999c7167e41 (patch) | |
tree | 30113145e257f510e587767d2b0d0f73b491f8a4 | |
parent | 3d09becf194bf1702a389ee59a7d6df899a570dd (diff) |
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.stahl@allotropia.de>
-rw-r--r-- | sw/source/core/doc/DocumentContentOperationsManager.cxx | 6 |
1 files changed, 6 insertions, 0 deletions
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 |