From: rnv Date: Mon, 6 Oct 2008 08:40:12 +0000 (+0000) Subject: Fix for IPAL20325 (Crash on create presentation for imported field). X-Git-Tag: V5_1_0a3~20 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ec3c5574c7a7b9aa2b915ee22a65591d6fe6a756;p=modules%2Fvisu.git Fix for IPAL20325 (Crash on create presentation for imported field). --- diff --git a/src/VISU_I/VISU_CorbaMedConvertor.cxx b/src/VISU_I/VISU_CorbaMedConvertor.cxx index 1bdcf0ae..367749de 100644 --- a/src/VISU_I/VISU_CorbaMedConvertor.cxx +++ b/src/VISU_I/VISU_CorbaMedConvertor.cxx @@ -1194,8 +1194,16 @@ VISU_MEDConvertor vtkIdType aDataType = VTK_DOUBLE; SALOME_MED::FIELDDOUBLE_ptr aFieldDouble = SALOME_MED::FIELDDOUBLE::_narrow(aMEDField); - if(aFieldDouble->_is_nil()) - aDataType = VTK_LONG; + if(aFieldDouble->_is_nil()){ + if (sizeof(long) == 4 ) // Size of CORBA::Long is always 4 (see CORBA_basetypes.h) + //Fix for IPAL20325 Crash on create presentation for imported field + aDataType = VTK_LONG; + else if (sizeof(int) == 4) + aDataType = VTK_INT; + else { + throw std::runtime_error("Can't map CORBA::Long to a VTK type"); + } + } aField->Init(aMEDField->getNumberOfComponents(), aDataType); aFieldMap[aFieldName.in()] = aField;