0023251: Crash during reading materials from STEP file for case when name of material...
authorgka <gka@opencascade.com>
Mon, 9 Jul 2012 13:52:35 +0000 (17:52 +0400)
committergka <gka@opencascade.com>
Fri, 13 Jul 2012 12:36:08 +0000 (16:36 +0400)
Fix for case when materials in STEP file was written invalid way

src/STEPCAFControl/STEPCAFControl_Reader.cxx

index ab57520..e4c44be 100755 (executable)
@@ -1928,7 +1928,10 @@ Standard_Boolean STEPCAFControl_Reader::ReadMaterials(const Handle(XSControl_Wor
             Handle(StepRepr_DescriptiveRepresentationItem) DRI =
               Handle(StepRepr_DescriptiveRepresentationItem)::DownCast(RI);
             aName = DRI->Name();
+            
             aDescription = DRI->Description();
+            if(aName.IsNull())
+              aName = aDescription;
           }
           if(RI->IsKind(STANDARD_TYPE(StepRepr_MeasureRepresentationItem))) {
             // try to find density for material
@@ -1960,7 +1963,9 @@ Standard_Boolean STEPCAFControl_Reader::ReadMaterials(const Handle(XSControl_Wor
         }
       }
     }
-    if( aName->Length()==0 ) continue;
+   
+    if( aName.IsNull() || aName->Length()==0 ) 
+      continue;
     // find shape label amd create Material link
     TopoDS_Shape aSh;
     Handle(StepShape_SolidModel) SM = FindSolidForPDS(PDS,graph);