Skip to content

Commit

Permalink
Fix crash with short TER record
Browse files Browse the repository at this point in the history
Fixes #1637

Signed-off-by: Geoff Hutchison <[email protected]>
  • Loading branch information
ghutchis committed Mar 2, 2024
1 parent 12e5606 commit 92b7c23
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions avogadro/io/pdbformat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,9 @@ bool PdbFormat::read(std::istream& in, Core::Molecule& mol)
}
}

else if (startsWith(buffer, "TER")) { // This is very important, each TER
// record also counts in the serial.
else if (startsWith(buffer, "TER") &&
buffer.length() >= 11) { // This is very important, each TER
// record also counts in the serial.
// Need to account for that when comparing with CONECT
terList.push_back(lexicalCast<int>(buffer.substr(6, 5), ok));

Expand Down

0 comments on commit 92b7c23

Please sign in to comment.