mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-14 02:27:09 -07:00
Don't use output parameters for error handling
This commit is contained in:
parent
4d480b8761
commit
41fc0fd084
12 changed files with 116 additions and 165 deletions
|
@ -1698,7 +1698,7 @@ void Session::handleDownloadFinished(const Net::DownloadResult &result)
|
|||
{
|
||||
case Net::DownloadStatus::Success:
|
||||
emit downloadFromUrlFinished(result.url);
|
||||
addTorrent(TorrentInfo::load(result.data), m_downloadedTorrents.take(result.url));
|
||||
addTorrent(TorrentInfo::load(result.data).value_or(TorrentInfo()), m_downloadedTorrents.take(result.url));
|
||||
break;
|
||||
case Net::DownloadStatus::RedirectedToMagnet:
|
||||
emit downloadFromUrlFinished(result.url);
|
||||
|
@ -2028,7 +2028,7 @@ bool Session::addTorrent(const QString &source, const AddTorrentParams ¶ms)
|
|||
return addTorrent(magnetUri, params);
|
||||
|
||||
TorrentFileGuard guard {source};
|
||||
if (addTorrent(TorrentInfo::loadFromFile(source), params))
|
||||
if (addTorrent(TorrentInfo::loadFromFile(source).value_or(TorrentInfo()), params))
|
||||
{
|
||||
guard.markAsAddedToSession();
|
||||
return true;
|
||||
|
@ -3938,8 +3938,7 @@ void Session::handleTorrentFinished(TorrentImpl *const torrent)
|
|||
qDebug("Found possible recursive torrent download.");
|
||||
const QString torrentFullpath = torrent->savePath(true) + '/' + torrentRelpath;
|
||||
qDebug("Full subtorrent path is %s", qUtf8Printable(torrentFullpath));
|
||||
TorrentInfo torrentInfo = TorrentInfo::loadFromFile(torrentFullpath);
|
||||
if (torrentInfo.isValid())
|
||||
if (TorrentInfo::loadFromFile(torrentFullpath))
|
||||
{
|
||||
qDebug("emitting recursiveTorrentDownloadPossible()");
|
||||
emit recursiveTorrentDownloadPossible(torrent);
|
||||
|
@ -4167,7 +4166,7 @@ void Session::recursiveTorrentDownload(const TorrentID &id)
|
|||
AddTorrentParams params;
|
||||
// Passing the save path along to the sub torrent file
|
||||
params.savePath = torrent->savePath();
|
||||
addTorrent(TorrentInfo::loadFromFile(torrentFullpath), params);
|
||||
addTorrent(TorrentInfo::loadFromFile(torrentFullpath).value_or(TorrentInfo()), params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue