[Libreoffice-commits] .: sw/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Mon Jan 30 09:15:27 PST 2012


 sw/source/core/fields/reffld.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 458d56d9b35f2ecb2eea2589737079390b10ee26
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Mon Jan 30 11:35:42 2012 +0100

    fdo#35669: more robust references merging

diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 5f1aa3a..05c3eda 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 );


More information about the Libreoffice-commits mailing list