Salome HOME
Fix for the issue #18499 EDF 20572 - Problem of points selection in viewer - crash...
authormpv <mpv@opencascade.com>
Thu, 9 Jan 2020 07:21:23 +0000 (10:21 +0300)
committermpv <mpv@opencascade.com>
Thu, 9 Jan 2020 07:23:04 +0000 (10:23 +0300)
src/Model/Model_BodyBuilder.cpp

index be65e0f403d277b5533790ffec305f4f7cf55a11..2c5c5c38187c29e3b3d63b96730e679d3294dd82 100644 (file)
@@ -183,7 +183,9 @@ void Model_BodyBuilder::store(const GeomShapePtr& theShape,
       return;  // null shape inside
 
     if(!theIsStoreSameShapes) {
-      Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(aShape, aShapeLab);
+      Handle(TNaming_NamedShape) aNS;
+      if (TNaming_Tool::HasLabel(aShapeLab, aShape))
+        aNS = TNaming_Tool::NamedShape(aShape, aShapeLab);
       // the last condition is for the issue 2751 : existing shape may be found in compound-NS
       if(!aNS.IsNull() && !aNS->IsEmpty() && aNS->Get().IsSame(aShape)) {
         // This shape is already in document, store reference instead of shape;
@@ -386,7 +388,9 @@ void Model_BodyBuilder::storeModified(const std::list<GeomShapePtr>& theOldShape
     if (aData.get()) {
       TDF_Label aShapeLab = aData->shapeLab();
       TopoDS_Shape aShapeNew = theNewShape->impl<TopoDS_Shape>();
-      Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(aShapeNew, aShapeLab);
+      Handle(TNaming_NamedShape) aNS;
+      if (TNaming_Tool::HasLabel(aShapeLab, aShapeNew))
+        aNS = TNaming_Tool::NamedShape(aShapeNew, aShapeLab);
       // the last condition is for the issue 2751 : existing shape may be found in compound-NS
       if (!aNS.IsNull() && !aNS->IsEmpty() && aNS->Get().IsSame(aShapeNew)) {
         // This shape is already in document, store reference instead of shape;