From 16bb5630bc8f246a14145137558d5b64460ce4b3 Mon Sep 17 00:00:00 2001 From: dpasukhi Date: Thu, 10 Sep 2020 19:28:58 +0300 Subject: [PATCH] 0031675: Data Exchange - Error opening the STEP-file Add a check for null array object ("Elements") within StepShape_GeometricSet.cxx --- src/StepShape/StepShape_GeometricSet.cxx | 2 ++ tests/bugs/step/bug31675 | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 tests/bugs/step/bug31675 diff --git a/src/StepShape/StepShape_GeometricSet.cxx b/src/StepShape/StepShape_GeometricSet.cxx index 24e59cbe77..bd76404127 100644 --- a/src/StepShape/StepShape_GeometricSet.cxx +++ b/src/StepShape/StepShape_GeometricSet.cxx @@ -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 index 0000000000..294564d600 --- /dev/null +++ b/tests/bugs/step/bug31675 @@ -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