Add more precondition checks when handle async operation result

PR  #19460.
This commit is contained in:
Vladimir Golovnev 2023-08-14 16:02:50 +03:00
parent 2b69cabc2c
commit 67d340ad63
2 changed files with 10 additions and 3 deletions

View file

@ -1602,6 +1602,7 @@ void TorrentImpl::applyFirstLastPiecePriority(const bool enabled)
void TorrentImpl::fileSearchFinished(const Path &savePath, const PathList &fileNames)
{
if (m_maintenanceJob == MaintenanceJob::HandleMetadata)
endReceivedMetadataHandling(savePath, fileNames);
}
@ -1635,7 +1636,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 (Q_UNLIKELY(m_maintenanceJob != MaintenanceJob::HandleMetadata))
return;
Q_ASSERT(m_filePaths.isEmpty());
if (Q_UNLIKELY(!m_filePaths.isEmpty()))
m_filePaths.clear();
lt::add_torrent_params &p = m_ltAddTorrentParams;