- if (aResult.get() && aResult->groupName() == ModelAPI_ResultPart::group()) {
- SessionPtr aMgr = ModelAPI_Session::get();
- aValid = aMgr->activeDocument() == aMgr->moduleDocument();
+ if (aResult.get()) {
+ if (aResult->groupName() == ModelAPI_ResultPart::group()) {
+ SessionPtr aMgr = ModelAPI_Session::get();
+ aValid = aMgr->activeDocument() == aMgr->moduleDocument();
+ } else if (aResult->groupName() == ModelAPI_ResultGroup::group()) {
+ aValid = Standard_False;
+ } else
+ aValid = Standard_True;