mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 15:37:26 -06:00
Don't use output parameters for error handling
This commit is contained in:
@@ -701,14 +701,14 @@ void TorrentsController::addAction()
|
||||
|
||||
for (auto it = data().constBegin(); it != data().constEnd(); ++it)
|
||||
{
|
||||
const BitTorrent::TorrentInfo torrentInfo = BitTorrent::TorrentInfo::load(it.value());
|
||||
if (!torrentInfo.isValid())
|
||||
const nonstd::expected<BitTorrent::TorrentInfo, QString> result = BitTorrent::TorrentInfo::load(it.value());
|
||||
if (!result)
|
||||
{
|
||||
throw APIError(APIErrorType::BadData
|
||||
, tr("Error: '%1' is not a valid torrent file.").arg(it.key()));
|
||||
}
|
||||
|
||||
partialSuccess |= BitTorrent::Session::instance()->addTorrent(torrentInfo, addTorrentParams);
|
||||
partialSuccess |= BitTorrent::Session::instance()->addTorrent(result.value(), addTorrentParams);
|
||||
}
|
||||
|
||||
if (partialSuccess)
|
||||
|
||||
Reference in New Issue
Block a user