mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-12 18:24:58 +08:00
Fix crash when removing phantom tags
Normally a tag is stored in both session and torrent's fastresume. A phantom tag is a tag that is stored in fastresume but not in session. This crash can occur when user resets his config file and choose to remove tag from torrent. Closes #10569.
This commit is contained in:
parent
e83019bdfa
commit
19f50a363d
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user