Commit a2f58501 by Maarten L. Hekkelman

avoid crash on empty branches

parent 283f4883
......@@ -35,8 +35,6 @@ include(CheckIncludeFiles)
include(CheckLibraryExists)
include(CMakePackageConfigHelpers)
include(CheckCXXSourceCompiles)
# include(Dart)
include(AddGitSubmodule)
set(CXX_EXTENSIONS OFF)
......
......@@ -1133,6 +1133,8 @@ branch::branch(structure &structure, const std::string &asym_id)
void branch::link_atoms()
{
if (not empty())
{
using namespace literals;
auto &db = m_structure->get_datablock();
......@@ -1151,6 +1153,7 @@ void branch::link_atoms()
s1.set_link(s2.get_atom_by_atom_id(atom2));
}
}
}
std::string branch::name() const
......@@ -1375,6 +1378,9 @@ void structure::load_data()
ri->second->add_atom(atom);
}
// what the ...
m_branches.erase(std::remove_if(m_branches.begin(), m_branches.end(), [](const branch &b) { return b.empty(); }), m_branches.end());
for (auto &branch : m_branches)
branch.link_atoms();
}
......
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