]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for IPAL20325 (Crash on create presentation for imported field).
authorrnv <rnv@opencascade.com>
Mon, 6 Oct 2008 08:40:12 +0000 (08:40 +0000)
committerrnv <rnv@opencascade.com>
Mon, 6 Oct 2008 08:40:12 +0000 (08:40 +0000)
src/VISU_I/VISU_CorbaMedConvertor.cxx

index 1bdcf0aee560b3ba0aafed51c8c8ed1a3961403a..367749deb3059d14955341adac90312e4928bcd6 100644 (file)
@@ -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;