0028797: Exceptrion is raised during reading attached STEP file.
authorgka <gka@opencascade.com>
Mon, 29 May 2017 15:42:55 +0000 (18:42 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 22 Jun 2017 08:29:14 +0000 (11:29 +0300)
Protection for null handle was added in the method RWStepVisual_RWPresentationStyleAssignment::ReadStep

src/RWStepVisual/RWStepVisual_RWPresentationStyleAssignment.cxx
tests/bugs/step/bug28797 [new file with mode: 0644]

index 76a200f..714957c 100644 (file)
@@ -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 (file)
index 0000000..a227a71
--- /dev/null
@@ -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