summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedric.bosdonnat.ooo@free.fr>2012-01-30 11:35:42 +0100
committerCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-01-30 18:14:19 +0100
commit458d56d9b35f2ecb2eea2589737079390b10ee26 (patch)
tree80104dbaf3a5f03bab91141872e5e167ad2cd954
parent2b7cfe121426f72651499aca73f61cf2f274a0a2 (diff)
fdo#35669: more robust references merging
-rw-r--r--sw/source/core/fields/reffld.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 5f1aa3a7523d..05c3eda29e16 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 );