mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0026461: STEP Import interface crashes
Add a check for NULL; some code refactoring.
This commit is contained in:
parent
4ae88e723d
commit
e84806af3b
@ -1085,10 +1085,15 @@ Standard_Boolean STEPCAFControl_Reader::ReadNames (const Handle(XSControl_WorkSe
|
|||||||
Handle(StepBasic_ProductDefinition) PD =
|
Handle(StepBasic_ProductDefinition) PD =
|
||||||
Handle(StepBasic_ProductDefinition)::DownCast(enti);
|
Handle(StepBasic_ProductDefinition)::DownCast(enti);
|
||||||
if(PD.IsNull()) continue;
|
if(PD.IsNull()) continue;
|
||||||
Handle(StepBasic_Product) Prod = PD->Formation()->OfProduct();
|
Handle(StepBasic_Product) Prod = (!PD->Formation().IsNull() ? PD->Formation()->OfProduct() : NULL);
|
||||||
if(!Prod->Name().IsNull() && Prod->Name()->UsefullLength()>0) name = Prod->Name();
|
if (Prod.IsNull())
|
||||||
else if (!Prod->Id().IsNull()) name = Prod->Id();
|
name = new TCollection_HAsciiString;
|
||||||
else name = new TCollection_HAsciiString;
|
else if (!Prod->Name().IsNull() && Prod->Name()->UsefullLength() > 0)
|
||||||
|
name = Prod->Name();
|
||||||
|
else if (!Prod->Id().IsNull())
|
||||||
|
name = Prod->Id();
|
||||||
|
else
|
||||||
|
name = new TCollection_HAsciiString;
|
||||||
L = GetLabelFromPD ( PD, STool, TP, PDFileMap, ShapeLabelMap );
|
L = GetLabelFromPD ( PD, STool, TP, PDFileMap, ShapeLabelMap );
|
||||||
if ( L.IsNull() ) continue;
|
if ( L.IsNull() ) continue;
|
||||||
TCollection_ExtendedString str ( name->String() );
|
TCollection_ExtendedString str ( name->String() );
|
||||||
|
11
tests/bugs/step/bug26461
Normal file
11
tests/bugs/step/bug26461
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC26461"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
#####################################################
|
||||||
|
# STEP Import interface crashes
|
||||||
|
#####################################################
|
||||||
|
|
||||||
|
ReadStep D [locate_data_file bug26461_test_ap227.stp]
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user