diff --git a/src/Mod/Part/App/Part2DObject.cpp b/src/Mod/Part/App/Part2DObject.cpp index 50023a26b..662f0d872 100644 --- a/src/Mod/Part/App/Part2DObject.cpp +++ b/src/Mod/Part/App/Part2DObject.cpp @@ -82,7 +82,13 @@ void Part2DObject::positionBySupport(void) const Part::TopoShape &shape = part->Shape.getShape(); if (shape._Shape.IsNull()) throw Base::Exception("Support shape is empty!"); - TopoDS_Shape sh = shape.getSubShape(sub[0].c_str()); + TopoDS_Shape sh; + try { + sh = shape.getSubShape(sub[0].c_str()); + } + catch (Standard_Failure) { + throw Base::Exception("Face in support shape doesn't exist!"); + } const TopoDS_Face &face = TopoDS::Face(sh); if (face.IsNull()) throw Base::Exception("Null face in Part2DObject::positionBySupport()!"); diff --git a/src/Mod/PartDesign/App/FeatureSketchBased.cpp b/src/Mod/PartDesign/App/FeatureSketchBased.cpp index 28c002b3c..64694c44a 100644 --- a/src/Mod/PartDesign/App/FeatureSketchBased.cpp +++ b/src/Mod/PartDesign/App/FeatureSketchBased.cpp @@ -731,7 +731,15 @@ void SketchBased::remapSupportShape(const TopoDS_Shape& newShape) } bool success = false; - TopoDS_Shape element = shape.getSubShape(it->c_str()); + TopoDS_Shape element; + try { + element = shape.getSubShape(it->c_str()); + } + catch (Standard_Failure) { + // This shape doesn't even exist, so no chance to do some tests + newSubValues.push_back(*it); + continue; + } try { // as very first test check if old face and new face are parallel planes TopoDS_Shape newElement = Part::TopoShape(newShape).getSubShape(it->c_str());