Skip to content

Commit

Permalink
Check to add bonds of valid atoms
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Hutchison <geoff.hutchison@gmail.com>
  • Loading branch information
ghutchis committed Jan 23, 2025
1 parent dff8003 commit 9380c41
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion avogadro/io/pdbformat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ bool PdbFormat::read(std::istream& in, Core::Molecule& mol)
b = b - terCount;
b = rawToAtomId[b];

if (a < b && a >= 0 && b >= 0) {
if (a < b && a >= 0 && b >= 0 && a < mol.atomCount() &&
b < mol.atomCount()) {
mol.Avogadro::Core::Molecule::addBond(a, b, 1);
}
}
Expand Down

0 comments on commit 9380c41

Please sign in to comment.