]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Correction of bug found thanks to MEDReader.
authorageay <ageay>
Fri, 24 Jan 2014 11:44:33 +0000 (11:44 +0000)
committerageay <ageay>
Fri, 24 Jan 2014 11:44:33 +0000 (11:44 +0000)
src/MEDLoader/MEDFileField.cxx

index 1df7f711432b733e1ce5eede3807012732bfd54e..0d5f1216e2819b110dcd16ffa8a0a7166b051a5f 100644 (file)
@@ -4126,16 +4126,24 @@ void MEDFileAnyTypeField1TSWithoutSDA::updateData(int newLgth, const std::vector
   if(_nb_of_tuples_to_be_allocated>=0)
     {
       _nb_of_tuples_to_be_allocated=newLgth;
+      const DataArray *oldArr(getUndergroundDataArray());
+      if(oldArr)
+        {
+          MEDCouplingAutoRefCountObjectPtr<DataArray> newArr(createNewEmptyDataArrayInstance());
+          newArr->setInfoAndChangeNbOfCompo(oldArr->getInfoOnComponents());
+          setArray(newArr);
+          _nb_of_tuples_to_be_allocated=newLgth;//force the _nb_of_tuples_to_be_allocated because setArray has been used specialy
+        }
       return ;
     }
   if(_nb_of_tuples_to_be_allocated==-1)
     return ;
   if(_nb_of_tuples_to_be_allocated==-2 || _nb_of_tuples_to_be_allocated==-3)
     {
-      const DataArray *oldArr=getUndergroundDataArray();
+      const DataArray *oldArr(getUndergroundDataArray());
       if(!oldArr || !oldArr->isAllocated())
         throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::updateData : internal error 1 !");
-      MEDCouplingAutoRefCountObjectPtr<DataArray> newArr=createNewEmptyDataArrayInstance();
+      MEDCouplingAutoRefCountObjectPtr<DataArray> newArr(createNewEmptyDataArrayInstance());
       newArr->alloc(newLgth,getNumberOfComponents());
       if(oldArr)
         newArr->copyStringInfoFrom(*oldArr);