Skip to content

Commit

Permalink
Fix issue with resuming a download that was already complete.
Browse files Browse the repository at this point in the history
  • Loading branch information
Silarn committed May 9, 2018
1 parent 2486c55 commit 11aa955
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/downloadmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,10 @@ void DownloadManager::startDownload(QNetworkReply *reply, DownloadInfo *newDownl

QCoreApplication::processEvents();

if (newDownload->m_State != STATE_DOWNLOADING && reply->isFinished()) {
if (newDownload->m_State != STATE_DOWNLOADING &&
newDownload->m_State != STATE_READY &&
newDownload->m_State != STATE_FETCHINGMODINFO &&
reply->isFinished()) {
downloadFinished(indexByName(newDownload->m_FileName));
return;
}
Expand Down Expand Up @@ -690,6 +693,14 @@ void DownloadManager::resumeDownloadInt(int index)
return;
}
DownloadInfo *info = m_ActiveDownloads[index];

// Check for finished download;
if (info->m_TotalSize <= info->m_Output.size()) {
setState(info, STATE_DOWNLOADING);
downloadFinished(index);
return;
}

if (info->isPausedState()) {
if ((info->m_Urls.size() == 0)
|| ((info->m_Urls.size() == 1) && (info->m_Urls[0].size() == 0))) {
Expand Down

0 comments on commit 11aa955

Please sign in to comment.