mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-14 02:27:09 -07:00
Assign temporary data to a variable
This is mainly to avoid dangerous code pattern: getting an iterator on a temporary object. Previously `data()` returns a const reference so the code wasn't doing any harm.
This commit is contained in:
parent
16bc0531f4
commit
b9b2ed64f9
1 changed files with 2 additions and 1 deletions
|
@ -717,7 +717,8 @@ void TorrentsController::addAction()
|
|||
}
|
||||
}
|
||||
|
||||
for (auto it = data().constBegin(); it != data().constEnd(); ++it)
|
||||
const DataMap torrents = data();
|
||||
for (auto it = torrents.constBegin(); it != torrents.constEnd(); ++it)
|
||||
{
|
||||
const nonstd::expected<BitTorrent::TorrentInfo, QString> result = BitTorrent::TorrentInfo::load(it.value());
|
||||
if (!result)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue