Salome HOME
Fix for the issue #2572 : Crash at attempt to perform "Remove Sub-Shapes" operation
[modules/shaper.git] / src / Model / Model_BodyBuilder.cpp
index 1a8ea5507f9518ca3810ac4bb6ba615e21bbfe6d..50ee39ca841addf806f59558c6ec05e2b2ed4882 100755 (executable)
@@ -47,6 +47,7 @@
 #include <TopExp.hxx>
 #include <BRepTools.hxx>
 #include <BRep_Tool.hxx>
+#include <BRepTools_History.hxx>
 #include <GeomAPI_Shape.h>
 #include <GeomAlgoAPI_MakeShape.h>
 #include <GeomAlgoAPI_SortListOfShapes.h>
@@ -369,7 +370,8 @@ void Model_BodyBuilder::loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
     if (theMS->isDeleted (aRShape)) {
       if (!aResultShape->isSubShape(aRShape, false)) {
           ListOfShape aHist;
-          theMS->modified(aRShape, aHist);
+          if (BRepTools_History::IsSupportedType(aRoot)) // to avoid crash in #2572
+            theMS->modified(aRShape, aHist);
           if (aHist.size() == 0 || (aHist.size() == 1 && aHist.front()->isSame(aRShape)))
             builder(theTag)->Delete(aRoot);
       }