Skip to content
Snippets Groups Projects
Verified Commit 9bc97d48 authored by Xavier Robin's avatar Xavier Robin Committed by Xavier Robin
Browse files

fix static_cast overflow in LocateAtom

An overflow would happen when the residue contains unknown atoms that
are not in the compound, and can prevent bonds from being properly
created in ConnectAtomsOfResidue.
parent 9c03a412
No related branches found
No related tags found
No related merge requests found
......@@ -327,10 +327,10 @@ void Processor::ReorderAtoms(mol::ResidueHandle residue,
mol::impl::AtomImplList::iterator i=impl->GetAtomList().begin();
for (; i!=impl->GetAtomList().end(); ++i) {
mol::impl::AtomImplPtr atom=*i;
atom->SetState(std::numeric_limits<unsigned int>::max());
atom->SetState(std::numeric_limits<int>::max());
int index=compound->GetAtomSpecIndex(atom->GetName());
if (index==-1) {
atom->SetState(std::numeric_limits<unsigned int>::max());
atom->SetState(std::numeric_limits<int>::max());
continue;
}
atom->SetState((compound->GetAtomSpecs())[index].ordinal);
......@@ -350,7 +350,7 @@ bool Processor::HasUnknownAtoms(mol::ResidueHandle res,
mol::AtomHandleList atoms=res.GetAtomList();
for (mol::AtomHandleList::iterator
i=atoms.begin(), e=atoms.end(); i!=e; ++i) {
if ((*i).Impl()->GetState()==std::numeric_limits<unsigned int>::max()) {
if ((*i).Impl()->GetState()==std::numeric_limits<int>::max()) {
if (((*i).GetElement()=="H" || (*i).GetElement()=="D") &&
!strict_hydrogens) {
continue;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment