diff options
author | Cédric Bosdonnat <cedric.bosdonnat.ooo@free.fr> | 2012-01-30 11:35:42 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-01-30 22:24:41 +0100 |
commit | 5de902f2b66e64bc4b4755356db3b259c01ddcdd (patch) | |
tree | 343675a72b93178ec47b69c58403c6ae9ec5ad49 | |
parent | d3294590d6c15205cc0a176e96ef04f2816079cd (diff) |
fdo#35669: more robust references merging
(cherry picked from commit 458d56d9b35f2ecb2eea2589737079390b10ee26)
Signed-off-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | sw/source/core/fields/reffld.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index c15c542be50d..eca22ba37ef5 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -974,11 +974,13 @@ void _RefIdsMap::Init( SwDoc& rDoc, SwDoc& rDestDoc, sal_Bool bField ) GetFieldIdsFromDoc( rDoc, aDstIds ); // Define the mappings now - sal_uInt16 nMaxDstId = *aIds.end(); + sal_uInt16 nMaxDstId = -1; + if ( !aIds.empty() ) + nMaxDstId = *aIds.rbegin(); // Map all the src fields to their value + nMaxDstId for ( std::set<sal_uInt16>::iterator pIt = aDstIds.begin(); pIt != aDstIds.end(); ++pIt ) - AddId( nMaxDstId++, *pIt ); + AddId( ++nMaxDstId, *pIt ); // Change the Sequence number of all the SetExp fields in the destination document SwFieldType* pType = rDoc.GetFldType( RES_SETEXPFLD, aName, false ); |