0031675: Data Exchange - Error opening the STEP-file
authordpasukhi <dpasukhi@opencascade.com>
Thu, 10 Sep 2020 16:28:58 +0000 (19:28 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 18 Sep 2020 14:47:01 +0000 (17:47 +0300)
Add a check for null array object ("Elements") within StepShape_GeometricSet.cxx

src/StepShape/StepShape_GeometricSet.cxx
tests/bugs/step/bug31675 [new file with mode: 0644]

index 24e59cb..bd76404 100644 (file)
@@ -49,5 +49,7 @@ StepShape_GeometricSetSelect StepShape_GeometricSet::ElementsValue(const Standar
 
 Standard_Integer StepShape_GeometricSet::NbElements () const
 {
+       if (elements.IsNull())
+               return 0;
        return elements->Length();
 }
diff --git a/tests/bugs/step/bug31675 b/tests/bugs/step/bug31675
new file mode 100644 (file)
index 0000000..294564d
--- /dev/null
@@ -0,0 +1,16 @@
+puts "===================================="
+puts "0031675: Er-ror opening the STEP-file"
+puts "===================================="
+puts ""
+
+pload DCAF
+
+# Read file
+ReadStep D [locate_data_file bug31675.stp]
+XGetOneShape res D
+
+# Checking 
+checknbshapes res -face 1036 -wire 2103 -compound 6
+checkshape res f
+
+Close D