Skip to content

Commit 1dadd87

Browse files
committed
Raise ObjCrystException when InitSpaceGroup fails
Fix try-catch block which may cause infinite recursion and/or masked failure of ChangeSpaceGroup.
1 parent f57a4ed commit 1dadd87

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

ObjCryst/ObjCryst/SpaceGroup.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -644,13 +644,17 @@ void SpaceGroup::InitSpaceGroup(const string &spgId)
644644

645645
mExtension='\0'; //this->GetCCTbxSpg().type().extension();
646646
}
647-
catch(exception &ex)
647+
catch(cctbx::error ex)
648648
{
649649
(*fpObjCrystInformUser)("Error initializing spacegroup (Incorrect Hall symbol ?):"+spgId);
650-
this->InitSpaceGroup(mId);
651-
(*fpObjCrystInformUser)("Reverting to spacegroup symbol:"+mId);
650+
if (mId != spgId)
651+
{
652+
(*fpObjCrystInformUser)("Reverting to spacegroup symbol:"+mId);
653+
this->InitSpaceGroup(mId);
654+
}
652655
VFN_DEBUG_EXIT("SpaceGroup::InitSpaceGroup() could not interpret spacegroup:"<<spgId<<":"<<ex.what(),8)
653-
return;
656+
string emsg = "Space group symbol '" + spgId + "' not recognized";
657+
throw ObjCrystException(emsg);
654658
}
655659

656660
mExtension=this->GetCCTbxSpg().match_tabulated_settings().extension();

0 commit comments

Comments
 (0)