diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-04-02 11:45:13 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-04-02 12:48:01 +0200 |
commit | 5ece3e3525b0ef62e1b0e59ac5446aec0538d0d3 (patch) | |
tree | f0f0edb20ac7c3477032e2e90e14ab3eb5d691e0 | |
parent | cbd8587ffb4b4e01705fc7f07fc4740382b78a08 (diff) |
tdf#85496: editeng: suppress all duplicate attributes during export
Since commit 0d57434180db6c8eda8c5b9b704f8a1c18b371df multiple 0-length
attributes will be exported by the ODF filter as duplicate attributes.
846b56b6b99e334dfa44f1a24640aa3158509854 was apparently not the only
bug that could cause this; unfortunately nobody is able to reproduce
the editing operations that result in the newly reported issue,
so just take the safe approach and check for duplicates,
as is already done in the libreoffice-4-3 and libreoffice-4-2 branches.
Change-Id: I1de10a99f6b84a0f4ea793ad55aaf6953b8307d5
-rw-r--r-- | editeng/source/editeng/editobj.cxx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index ea20882d99d0..9751f32cf77d 100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -993,11 +993,18 @@ void EditTextObjectImpl::GetAllSections( std::vector<editeng::Section>& rAttrs ) { editeng::Section& rSecAttr = *itCurAttr; // serious bug: will cause duplicate attributes to be exported - assert(rSecAttr.maAttributes.end() == std::find_if( + auto iter(std::find_if( rSecAttr.maAttributes.begin(), rSecAttr.maAttributes.end(), [&pItem](SfxPoolItem const*const pIt) { return pIt->Which() == pItem->Which(); })); - rSecAttr.maAttributes.push_back(pItem); + if (rSecAttr.maAttributes.end() == iter) + { + rSecAttr.maAttributes.push_back(pItem); + } + else + { + SAL_WARN("editeng", "GetAllSections(): duplicate attribute suppressed"); + } } } } |