Commit 3d835b8a by Augustin Zidek Committed by GitHub

Don't try to validate in annotateDSSP when the validator is not set (nullptr)

Fixes a segfault if one passes in a Cif datablock that didn't have `cif::pdb::reconstruct_pdbx(cif_file);` called on it.
parent 778d0ad5
...@@ -747,6 +747,7 @@ void annotateDSSP(cif::datablock &db, const dssp &dssp, bool writeOther, bool wr ...@@ -747,6 +747,7 @@ void annotateDSSP(cif::datablock &db, const dssp &dssp, bool writeOther, bool wr
{ {
using namespace std::literals; using namespace std::literals;
if (db.get_validator() != nullptr) {
auto &validator = const_cast<cif::validator &>(*db.get_validator()); auto &validator = const_cast<cif::validator &>(*db.get_validator());
if (validator.get_validator_for_category("dssp_struct_summary") == nullptr) if (validator.get_validator_for_category("dssp_struct_summary") == nullptr)
{ {
...@@ -754,6 +755,7 @@ void annotateDSSP(cif::datablock &db, const dssp &dssp, bool writeOther, bool wr ...@@ -754,6 +755,7 @@ void annotateDSSP(cif::datablock &db, const dssp &dssp, bool writeOther, bool wr
if (dssp_extension) if (dssp_extension)
cif::extend_dictionary(validator, *dssp_extension); cif::extend_dictionary(validator, *dssp_extension);
} }
}
if (dssp.empty()) if (dssp.empty())
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment