0028842: Attribute TNaming_NamedShape is not restored from .sgd document
authorvro <vro@opencascade.com>
Fri, 23 Jun 2017 08:13:47 +0000 (11:13 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 29 Jun 2017 11:24:18 +0000 (14:24 +0300)
src/ShapePersistent/ShapePersistent_BRep.cxx
tests/xml/data/ocaf/D7 [new file with mode: 0644]

index 3ba3ac2..d23c4ce 100644 (file)
@@ -644,7 +644,8 @@ Handle(TopoDS_TShape) ShapePersistent_BRep::pTVertex::createTShape() const
   aTVertex->Tolerance (myTolerance);
   aTVertex->Pnt       (myPnt);
 
-  myPoints->Import (aTVertex->ChangePoints());
+  if (myPoints)
+    myPoints->Import (aTVertex->ChangePoints());
 
   return aTVertex;
 }
@@ -662,7 +663,8 @@ Handle(TopoDS_TShape) ShapePersistent_BRep::pTEdge::createTShape() const
   aTEdge->SameRange     ((myFlags & RangeMask)       != 0);
   aTEdge->Degenerated   ((myFlags & DegeneratedMask) != 0);
 
-  myCurves->Import (aTEdge->ChangeCurves());
+  if (myCurves)
+    myCurves->Import (aTEdge->ChangeCurves());
 
   return aTEdge;
 }
diff --git a/tests/xml/data/ocaf/D7 b/tests/xml/data/ocaf/D7
new file mode 100644 (file)
index 0000000..85d6ce0
--- /dev/null
@@ -0,0 +1,12 @@
+#Test of bug 28842 (failure on open a standard OCAF document on Fedora).
+
+Open [locate_data_file save_V7_8_0_GEOM_MDTV-Standard.sgd] D
+
+# Check a shape.
+set res [CheckLabel D 0:1:20:1:1:2]
+set index [lsearch ${res} TNaming_NamedShape]
+if { ${index} == -1} {
+    puts "Error: reading of the document failed."
+} else {
+    puts "OK"
+}