Skip to content

Commit

Permalink
Merge pull request #677 from ghutchis/fix-650-part2
Browse files Browse the repository at this point in the history
Fix #650 part 2
  • Loading branch information
ghutchis committed Jul 16, 2021
2 parents ec7f38f + e3e7bf0 commit 91db7e7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions avogadro/core/molecule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,13 @@ bool Molecule::removeAtom(Index index)
if (m_colors.size() == atomCount())
m_colors.swapAndPop(index);

if (m_selectedAtoms.size() == atomCount())
m_selectedAtoms.erase(m_selectedAtoms.begin() + index);
if (m_selectedAtoms.size() == atomCount()) {
// swap and pop on std::vector<bool>
if (index != m_selectedAtoms.size() - 1) {
m_selectedAtoms[index] = m_selectedAtoms.back();
}
m_selectedAtoms.pop_back();
}

Index affectedIndex = static_cast<Index>(m_atomicNumbers.size() - 1);
m_atomicNumbers.swapAndPop(index);
Expand Down

0 comments on commit 91db7e7

Please sign in to comment.