From: ageay Date: Fri, 24 Jan 2014 11:44:33 +0000 (+0000) Subject: Correction of bug found thanks to MEDReader. X-Git-Tag: V7_3_1b1^2~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e403d099275934753a155e3d8f8db5deca04e693;p=modules%2Fmed.git Correction of bug found thanks to MEDReader. --- diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index 1df7f7114..0d5f1216e 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -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 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 newArr=createNewEmptyDataArrayInstance(); + MEDCouplingAutoRefCountObjectPtr newArr(createNewEmptyDataArrayInstance()); newArr->alloc(newLgth,getNumberOfComponents()); if(oldArr) newArr->copyStringInfoFrom(*oldArr);