diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-12-10 14:56:27 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-12-10 16:25:53 +0100 |
commit | 57dda65018847e7c432b60ea218b4ef3e314e5cc (patch) | |
tree | 703174a65db19ed591b7d558c3fa922a91dc60e5 /sw | |
parent | 2b577a316ad000bbc9378e180844c14e31e63706 (diff) |
sw: don't assert when SwXBookmark creates duplicate CrossRef*Bookmark
The bugdoc of fdo#87110 has a couple such duplicates. Check for it and
let SwXBookmark throw an IllegalArgumentException.
Change-Id: I460dc3a8d9c554c194a32a73526e13422ddd1c52
(cherry picked from commit 7a12360e1f2c0a5bc0927131a750740d35cfd1ab)
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/docbm.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index 22cef6b83fa1..b7487ec9f4bc 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -373,11 +373,13 @@ namespace sw { namespace mark "MarkManager::makeMark(..)" " - more than USHRT_MAX marks are not supported correctly"); // There should only be one CrossRefBookmark per Textnode per Type - assert(( - (eType != CROSSREF_NUMITEM_BOOKMARK && eType != CROSSREF_HEADING_BOOKMARK) - || (lcl_FindMarkAtPos(m_vBookmarks, *rPaM.GetPoint(), eType) == m_vBookmarks.end())) && - "MarkManager::makeMark(..)" - " - creating duplicate CrossRefBookmark"); + if ((eType == CROSSREF_NUMITEM_BOOKMARK || eType == CROSSREF_HEADING_BOOKMARK) + && (lcl_FindMarkAtPos(m_vBookmarks, *rPaM.GetPoint(), eType) != m_vBookmarks.end())) + { // this can happen via UNO API + SAL_WARN("sw.core", "MarkManager::makeMark(..)" + " - refusing to create duplicate CrossRefBookmark"); + return 0; + } // create mark pMark_t pMark; |