]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix
authordbv <dbv@opencascade.com>
Fri, 26 Oct 2018 15:04:25 +0000 (18:04 +0300)
committermpv <mpv@opencascade.com>
Fri, 26 Oct 2018 17:06:01 +0000 (20:06 +0300)
src/Model/Model_AttributeSelection.cpp

index b3357626fea9c932f7f7aa20eb90def166dc762a..7dc0453dd764cd71d068785a839f9c764a1278d0 100644 (file)
@@ -1720,18 +1720,23 @@ ResultPtr Model_AttributeSelection::newestContext(
     aFindNewContext = false;
     // try to find the last context to find the up to date shape
     TopoDS_Shape aConShape = aResult->shape()->impl<TopoDS_Shape>();
-    Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(aConShape, selectionLabel());
-    if (!aNS.IsNull()) {
-      aNS = TNaming_Tool::CurrentNamedShape(aNS);
-      if (!aNS.IsNull() && isLater(selectionLabel(), aNS->Label()) &&
-          isLater(aNS->Label(), std::dynamic_pointer_cast<Model_Data>(aResult->data())->label())) {
-        TDF_Label aLab = aNS->Label();
-        ResultPtr aRes = aDoc->resultByLab(aLab);
-        if (aRes.get()) {
-          if (theAnyValue || aRes->shape()->isSubShape(aSelectedShape)) {
-            aResult = aRes;
-            aFindNewContext = true;
-            continue;
+    if (TNaming_Tool::HasLabel(selectionLabel(), aConShape)) {
+      Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(aConShape, selectionLabel());
+      if (!aNS.IsNull()) {
+        aNS = TNaming_Tool::CurrentNamedShape(aNS);
+        if (!aNS.IsNull()
+            && isLater(selectionLabel(), aNS->Label())
+            && isLater(aNS->Label(),
+                       std::dynamic_pointer_cast<Model_Data>(aResult->data())->label()))
+        {
+          TDF_Label aLab = aNS->Label();
+          ResultPtr aRes = aDoc->resultByLab(aLab);
+          if (aRes.get()) {
+            if (theAnyValue || aRes->shape()->isSubShape(aSelectedShape)) {
+              aResult = aRes;
+              aFindNewContext = true;
+              continue;
+            }
           }
         }
       }