diff --git a/src/gui/tagfiltermodel.cpp b/src/gui/tagfiltermodel.cpp index 02ab1c92f..99f22b67f 100644 --- a/src/gui/tagfiltermodel.cpp +++ b/src/gui/tagfiltermodel.cpp @@ -216,15 +216,15 @@ void TagFilterModel::torrentTagAdded(BitTorrent::TorrentHandle *const torrent, c void TagFilterModel::torrentTagRemoved(BitTorrent::TorrentHandle *const torrent, const QString &tag) { - Q_ASSERT(torrent->tags().count() >= 0); - if (torrent->tags().count() == 0) + if (torrent->tags().empty()) untaggedItem()->increaseTorrentsCount(); const int row = findRow(tag); - Q_ASSERT(isValidRow(row)); - TagModelItem &item = m_tagItems[row]; + if (row < 0) + return; + + m_tagItems[row].decreaseTorrentsCount(); - item.decreaseTorrentsCount(); const QModelIndex i = index(row, 0, QModelIndex()); emit dataChanged(i, i); }