0029633: Data Exchange - access violation in StepVisual_PresentationStyleAssignment...
authorika <ika@opencascade.com>
Fri, 23 Mar 2018 15:12:00 +0000 (18:12 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 29 Mar 2018 14:13:29 +0000 (17:13 +0300)
Add several checks for null.

src/STEPCAFControl/STEPCAFControl_Reader.cxx
src/StepVisual/StepVisual_PresentationStyleAssignment.cxx
src/StepVisual/StepVisual_SurfaceSideStyle.cxx
tests/gdt/export/C3 [new file with mode: 0644]

index c282e26..75fd04b 100644 (file)
@@ -3415,7 +3415,7 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
     aDimObj->SetClassOfTolerance(aHolle, aFV, aG);
   }
 
-  if (!aCRI.IsNull() && aCRI->ItemElement()->Length() > 0)
+  if (!aCRI.IsNull() && !aCRI->ItemElement().IsNull() && aCRI->ItemElement()->Length() > 0)
   {
     //get modifiers
     XCAFDimTolObjects_DimensionModifiersSequence aModifiers;
index f846b5d..50a71fb 100644 (file)
@@ -45,5 +45,5 @@ StepVisual_PresentationStyleSelect StepVisual_PresentationStyleAssignment::Style
 
 Standard_Integer StepVisual_PresentationStyleAssignment::NbStyles () const
 {
-       return styles->Length();
+  return (styles.IsNull()) ?  0 : styles->Length();
 }
index f6510a2..a345ff7 100644 (file)
@@ -58,5 +58,5 @@ StepVisual_SurfaceStyleElementSelect StepVisual_SurfaceSideStyle::StylesValue(co
 
 Standard_Integer StepVisual_SurfaceSideStyle::NbStyles () const
 {
-       return styles->Length();
+  return (styles.IsNull()) ? 0 : styles->Length();
 }
diff --git a/tests/gdt/export/C3 b/tests/gdt/export/C3
new file mode 100644 (file)
index 0000000..52cd6bd
--- /dev/null
@@ -0,0 +1,19 @@
+# !!!! This file is generated automatically, do not edit manually! See end script
+set filename bug29633_nist_ctc_05_asme1_ap242-1.stp
+
+set ref_data {
+
+ NbOfDimensions          : 28
+  NbOfDimensionalSize    : 1
+  NbOfDimensionalLocation: 5
+  NbOfAngular            : 0
+  NbOfWithPath           : 0
+  NbOfCommonLabels       : 2
+ NbOfTolerances          : 10
+  NbOfGTWithModifiers    : 0
+  NbOfGTWithMaxTolerance : 0
+  NbOfGTWithDatums       : 8
+ NbOfDatumFeature        : 2
+ NbOfAttachedDatum       : 9
+ NbOfDatumTarget         : 0
+}