From ec3c5574c7a7b9aa2b915ee22a65591d6fe6a756 Mon Sep 17 00:00:00 2001 From: rnv Date: Mon, 6 Oct 2008 08:40:12 +0000 Subject: [PATCH] Fix for IPAL20325 (Crash on create presentation for imported field). --- src/VISU_I/VISU_CorbaMedConvertor.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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; -- 2.39.2