From: gka Date: Mon, 9 Jul 2012 13:52:35 +0000 (+0400) Subject: 0023251: Crash during reading materials from STEP file for case when name of material... X-Git-Tag: V6_5_4_beta1~143 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=87073a10177ce28ccc9806a3874b82d20ca15138;p=occt-copy.git 0023251: Crash during reading materials from STEP file for case when name of material is not set. Fix for case when materials in STEP file was written invalid way --- diff --git a/src/STEPCAFControl/STEPCAFControl_Reader.cxx b/src/STEPCAFControl/STEPCAFControl_Reader.cxx index ab5752030b..e4c44be55d 100755 --- a/src/STEPCAFControl/STEPCAFControl_Reader.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Reader.cxx @@ -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);