[Libreoffice-commits] .: sc/source

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Thu Aug 25 12:07:52 PDT 2011


 sc/source/core/data/cell.cxx |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit c305f3cd2cdea7a3908b6eeeaa374ca32aac6d41
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Aug 25 21:03:05 2011 +0200

    be extrasave and check for problems with ScRangeName::insert

diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
index 943842f..05c2279 100644
--- a/sc/source/core/data/cell.cxx
+++ b/sc/source/core/data/cell.cxx
@@ -179,10 +179,18 @@ void adjustRangeName(ScToken* pToken, ScDocument& rNewDoc, const ScDocument* pOl
     {
         bNewGlobal = bOldGlobal;
         pRangeData = new ScRangeData(*pOldRangeData, &rNewDoc);
+        bool bInserted;
         if (bNewGlobal)
-            rNewDoc.GetRangeName()->insert(pRangeData);
+            bInserted = rNewDoc.GetRangeName()->insert(pRangeData);
         else
-            rNewDoc.GetRangeName(aNewTab)->insert(pRangeData);
+            bInserted = rNewDoc.GetRangeName(aNewTab)->insert(pRangeData);
+        if (!bInserted)
+        {
+            //if this happened we have a real problem
+            delete pRangeData;
+            pToken->SetIndex(-1);
+            OSL_FAIL("inserting the range name should not fail");
+        }
     }
     sal_Int32 nIndex = pRangeData->GetIndex();
     pToken->SetIndex(nIndex);


More information about the Libreoffice-commits mailing list