1 diff --git a/src/ModuleBase/ModuleBase_WidgetSelector.cpp b/src/ModuleBase/ModuleBase_WidgetSelector.cpp
2 index 6876a337f..65444345e 100644
3 --- a/src/ModuleBase/ModuleBase_WidgetSelector.cpp
4 +++ b/src/ModuleBase/ModuleBase_WidgetSelector.cpp
5 @@ -73,7 +73,9 @@ void ModuleBase_WidgetSelector::getGeomSelection(const ModuleBase_ViewerPrsPtr&
6 theShape = aSelection->getShape(thePrs);
8 FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
9 - while (aFeature && aFeature->lastResult()->groupName() == ModelAPI_ResultGroup::group()) {
10 + while (aFeature.get() &&
11 + aFeature->lastResult().get() &&
12 + aFeature->lastResult()->groupName() == ModelAPI_ResultGroup::group()) {
13 if (!getObjectFromGroup(theObject, theShape))
15 aFeature = ModelAPI_Feature::feature(theObject);
16 @@ -297,4 +299,4 @@ bool getObjectFromGroup(ObjectPtr& theObject, GeomShapePtr& theShape)
21 \ No newline at end of file