Salome HOME
Change icons for chamfer
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Tools.cpp
index fb6401e1181a09efbb86d511e2f2b7db8a36bcac..4f55be24d485ffb1d9997890f99f5da42e708fcd 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "SketchPlugin_Tools.h"
@@ -106,7 +105,7 @@ std::set<FeaturePtr> findCoincidentConstraints(const FeaturePtr& theFeature)
   std::set<AttributePtr>::const_iterator aIt;
   for (aIt = aRefsList.cbegin(); aIt != aRefsList.cend(); ++aIt) {
     FeaturePtr aConstrFeature = std::dynamic_pointer_cast<ModelAPI_Feature>((*aIt)->owner());
-    if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID())
+    if (aConstrFeature && aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID())
       aCoincident.insert(aConstrFeature);
   }
   return aCoincident;
@@ -191,11 +190,14 @@ public:
     std::list< std::set<AttributePoint2DPtr> >::iterator aFound1 = find(thePoint1);
     std::list< std::set<AttributePoint2DPtr> >::iterator aFound2 = find(thePoint2);
     if (aFound1 == myCoincidentPoints.end()) {
-      std::set<AttributePoint2DPtr> aNewSet;
-      aNewSet.insert(thePoint1);
-      if (thePoint2)
-        aNewSet.insert(thePoint2);
-      myCoincidentPoints.push_back(aNewSet);
+      if (aFound2 == myCoincidentPoints.end()) {
+        std::set<AttributePoint2DPtr> aNewSet;
+        aNewSet.insert(thePoint1);
+        if (thePoint2)
+          aNewSet.insert(thePoint2);
+        myCoincidentPoints.push_back(aNewSet);
+      } else
+        aFound2->insert(thePoint1);
     } else if (aFound2 == myCoincidentPoints.end()) {
       if (thePoint2)
         aFound1->insert(thePoint2);