Skip to content

Commit

Permalink
Merge pull request #1640 from ghutchis/fix-pdb-crash-ter-record
Browse files Browse the repository at this point in the history
Fix crash with short TER record in PDB files
  • Loading branch information
ghutchis authored Mar 3, 2024
2 parents ab5331d + 92b7c23 commit 43567b2
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 43567b2

Please sign in to comment.