From 26a2122d60d008b529cfaedc9976b0f8e66d4d46 Mon Sep 17 00:00:00 2001 From: mpv Date: Wed, 7 Nov 2018 16:42:35 +0300 Subject: [PATCH] Fix crashes of unit-tests --- src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp | 4 ++-- src/FeaturesPlugin/Test/Test1379.py | 2 +- src/Model/Model_AttributeSelection.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp b/src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp index 4ac87606e..2f941d59e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp @@ -158,7 +158,7 @@ bool FeaturesPlugin_Revolution::makeRevolutions(ListOfShape& theBaseShapes, if(!aToShape.get() && aSelection->context().get()) { aToShape = aSelection->context()->shape(); } - if (aToShape->isCompound()) { + if (aToShape.get() && aToShape->isCompound()) { GeomAPI_ShapeIterator anIt(aToShape); aToShape = anIt.current(); } @@ -169,7 +169,7 @@ bool FeaturesPlugin_Revolution::makeRevolutions(ListOfShape& theBaseShapes, if(!aFromShape.get() && aSelection->context().get()) { aFromShape = aSelection->context()->shape(); } - if (aFromShape->isCompound()) { + if (aFromShape.get() && aFromShape->isCompound()) { GeomAPI_ShapeIterator anIt(aFromShape); aFromShape = anIt.current(); } diff --git a/src/FeaturesPlugin/Test/Test1379.py b/src/FeaturesPlugin/Test/Test1379.py index 6523d3b8a..9fdb8f1be 100644 --- a/src/FeaturesPlugin/Test/Test1379.py +++ b/src/FeaturesPlugin/Test/Test1379.py @@ -167,7 +167,7 @@ SketchConstraintDistance_7 = Sketch_2.setDistance(SketchLine_18.result(), Sketch model.do() Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchArc_1_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 0.008999999999999999, 0.008999999999999999) Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Extrusion_1_1")]) -Axis_4 = model.addAxis(Part_1_doc, model.selection("FACE", "(Extrusion_1_1/From_Face)7(Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2)7(Extrusion_1_1/To_Face)7")) +Axis_4 = model.addAxis(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_7")) RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 10, 28, [model.selection("SOLID", "Fuse_1_1")]) Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) SketchLine_19 = Sketch_3.addLine(0.029, 0.042, 0.029, 0.03267384683690003) diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index b58e29461..77f6bb5fa 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -1442,7 +1442,7 @@ void Model_AttributeSelection::updateInHistory() if (aValueShape.get()) { aShapeShapeType = aValueShape->shapeType(); } else { - (*aNewCont)->shape()->shapeType(); + aShapeShapeType = (*aNewCont)->shape()->shapeType(); } if (aListShapeType != GeomAPI_Shape::SHAPE && aListShapeType != aShapeShapeType) { continue; -- 2.39.2