Commit a2f58501 by Maarten L. Hekkelman

avoid crash on empty branches

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