Browse Source

Add more precondition checks when handle async operation result

PR  #19460.
adaptive-webui-19844
Vladimir Golovnev 1 year ago committed by GitHub
parent
commit
cab5edb721
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/base/bittorrent/torrentimpl.cpp

7
src/base/bittorrent/torrentimpl.cpp

@ -1598,6 +1598,7 @@ void TorrentImpl::applyFirstLastPiecePriority(const bool enabled) @@ -1598,6 +1598,7 @@ void TorrentImpl::applyFirstLastPiecePriority(const bool enabled)
void TorrentImpl::fileSearchFinished(const Path &savePath, const PathList &fileNames)
{
if (m_maintenanceJob == MaintenanceJob::HandleMetadata)
endReceivedMetadataHandling(savePath, fileNames);
}
@ -1630,7 +1631,13 @@ std::shared_ptr<const libtorrent::torrent_info> TorrentImpl::nativeTorrentInfo() @@ -1630,7 +1631,13 @@ std::shared_ptr<const libtorrent::torrent_info> TorrentImpl::nativeTorrentInfo()
void TorrentImpl::endReceivedMetadataHandling(const Path &savePath, const PathList &fileNames)
{
Q_ASSERT(m_maintenanceJob == MaintenanceJob::HandleMetadata);
if (m_maintenanceJob != MaintenanceJob::HandleMetadata) [[unlikely]]
return;
Q_ASSERT(m_filePaths.isEmpty());
if (!m_filePaths.isEmpty()) [[unlikely]]
m_filePaths.clear();
lt::add_torrent_params &p = m_ltAddTorrentParams;

Loading…
Cancel
Save