mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 21:03:30 -07:00
Fix unchecked dynamic_cast
Replace some unnecessary (and slow) dynamic_cast with static_cast.
This commit is contained in:
parent
a203246e85
commit
a35cbdc4a9
2 changed files with 7 additions and 4 deletions
|
@ -167,9 +167,12 @@ TorrentContentModelItem::ItemType TorrentContentModel::itemType(const QModelInde
|
|||
|
||||
int TorrentContentModel::getFileIndex(const QModelIndex& index)
|
||||
{
|
||||
TorrentContentModelFile* item = dynamic_cast<TorrentContentModelFile*>(static_cast<TorrentContentModelItem*>(index.internalPointer()));
|
||||
Q_ASSERT(item);
|
||||
return item->fileIndex();
|
||||
TorrentContentModelItem *item = static_cast<TorrentContentModelItem*>(index.internalPointer());
|
||||
if (item->itemType() == TorrentContentModelItem::FileType)
|
||||
return static_cast<TorrentContentModelFile*>(item)->fileIndex();
|
||||
|
||||
Q_ASSERT(item->itemType() == TorrentContentModelItem::FileType);
|
||||
return -1;
|
||||
}
|
||||
|
||||
QVariant TorrentContentModel::data(const QModelIndex& index, int role) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue