Skip to content

Commit

Permalink
registry: Fix crash on docset removal (fixes #420)
Browse files Browse the repository at this point in the history
According to the bug report sometimes ListModel::removeDocset() is called
for docsets not in the model. This change adds a simple check, but
does not address the real unknown issue.
  • Loading branch information
trollixx committed Nov 7, 2015
1 parent 58e2080 commit e182e59
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/registry/listmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ void ListModel::addDocset(const QString &name)
void ListModel::removeDocset(const QString &name)
{
const int index = m_docsetItems.keys().indexOf(name);
/// TODO: Investigate why this can happen (see #420)
if (index == -1)
return;

beginRemoveRows(QModelIndex(), index, index);

DocsetItem *docsetItem = m_docsetItems.take(name);
Expand Down

0 comments on commit e182e59

Please sign in to comment.