From 12b86472db6312be4031a3c4c9e4294a13b227a6 Mon Sep 17 00:00:00 2001 From: abv Date: Thu, 17 Mar 2016 15:04:19 +0300 Subject: [PATCH] 0027277: geom/extruded_00/A0: OCAF document is not opened correctly Reading of attribute TDataStd_ExtStringList from CSFDB format is corrected for null strings: empty value is used. Test bugs caf bug27277 added. --- src/StdLPersistent/StdLPersistent_Collection.cxx | 12 +++++------- tests/bugs/caf/bug27277 | 12 ++++++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 tests/bugs/caf/bug27277 diff --git a/src/StdLPersistent/StdLPersistent_Collection.cxx b/src/StdLPersistent/StdLPersistent_Collection.cxx index 3deffb8162..52029b2f05 100644 --- a/src/StdLPersistent/StdLPersistent_Collection.cxx +++ b/src/StdLPersistent/StdLPersistent_Collection.cxx @@ -40,14 +40,12 @@ struct StdLPersistent_Collection::stringConverter const TCollection_ExtendedString& operator() (const Handle(StdObjMgt_Persistent)& theValue) const { - Handle(TCollection_HExtendedString) aString = theValue->ExtString(); - if (aString) - return aString->String(); - else - { - static TCollection_ExtendedString anEmptyString; + static TCollection_ExtendedString anEmptyString; + if (theValue.IsNull()) return anEmptyString; - } + + Handle(TCollection_HExtendedString) aString = theValue->ExtString(); + return aString ? aString->String() : anEmptyString; } }; diff --git a/tests/bugs/caf/bug27277 b/tests/bugs/caf/bug27277 new file mode 100644 index 0000000000..6a164207d1 --- /dev/null +++ b/tests/bugs/caf/bug27277 @@ -0,0 +1,12 @@ +puts "===========" +puts "0027277: geom/extruded_00/A0: OCAF document is not opened correctly" +puts "===========" + + +Open [locate_data_file bug27277_GEOM.sgd] D + +# check result of reading by number of attributes in dump +set dump [XDumpDF D] +if { ! [regexp {418 attributes dumped between 418} $dump] } { + puts "Error: expected 418 attributes in resulting document" +}