Browse Source

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.
adaptive-webui-19844
Chocobo1 3 years ago
parent
commit
b9b2ed64f9
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 3
      src/webui/api/torrentscontroller.cpp

3
src/webui/api/torrentscontroller.cpp

@ -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()); const nonstd::expected<BitTorrent::TorrentInfo, QString> result = BitTorrent::TorrentInfo::load(it.value());
if (!result) if (!result)

Loading…
Cancel
Save