From b80d766ab943d68794e96f67c7c2e2138f65241c Mon Sep 17 00:00:00 2001 From: gka Date: Mon, 29 May 2017 18:42:55 +0300 Subject: [PATCH] 0028797: Exceptrion is raised during reading attached STEP file. Protection for null handle was added in the method RWStepVisual_RWPresentationStyleAssignment::ReadStep --- ...StepVisual_RWPresentationStyleAssignment.cxx | 7 +++++-- tests/bugs/step/bug28797 | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 tests/bugs/step/bug28797 diff --git a/src/RWStepVisual/RWStepVisual_RWPresentationStyleAssignment.cxx b/src/RWStepVisual/RWStepVisual_RWPresentationStyleAssignment.cxx index 76a200f056..714957ce76 100644 --- a/src/RWStepVisual/RWStepVisual_RWPresentationStyleAssignment.cxx +++ b/src/RWStepVisual/RWStepVisual_RWPresentationStyleAssignment.cxx @@ -53,9 +53,12 @@ void RWStepVisual_RWPresentationStyleAssignment::ReadStep else { Handle(StepData_SelectMember) aMember; data->ReadMember(nsub1, i1, "null_style", ach, aMember); - Standard_CString anEnumText = aMember->EnumText(); Handle(StepVisual_NullStyleMember) aNullStyle = new StepVisual_NullStyleMember(); - aNullStyle->SetEnumText(0, anEnumText); + if(!aMember.IsNull()) + { + Standard_CString anEnumText = aMember->EnumText(); + aNullStyle->SetEnumText(0, anEnumText); + } aStylesItem.SetValue(aNullStyle); } aStyles->SetValue(i1,aStylesItem); diff --git a/tests/bugs/step/bug28797 b/tests/bugs/step/bug28797 new file mode 100644 index 0000000000..a227a71198 --- /dev/null +++ b/tests/bugs/step/bug28797 @@ -0,0 +1,17 @@ +puts "========" +puts "OCC28797" +puts "========" +puts "" +######################################################################### +# Data Exchange - Exception is raised during reading attached STEP file +######################################################################### + +set aFile [locate_data_file bug28797_36x60.step] + +if {[catch {stepread $aFile a *}]} { + puts "ERROR: OCC28797 is reproduced. Exception was raised during reading initial file." +} else { + tpcompound result +} + +checkview -display result -2d -path ${imagedir}/${test_image}.png