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

index f8da47ae56a7428063ab382efe3d88f56fa42f98..cee210c7a001d7954c4926eafef2f836c06a3bf2 100644 (file)
@@ -1194,10 +1194,17 @@ 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;
 
       if(MYDEBUG)