mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-27 08:19:30 +08: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
@ -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…
Reference in New Issue
Block a user