Skip to content

Commit

Permalink
Merge pull request #497 from Modorganizer2/Develop
Browse files Browse the repository at this point in the history
Fix possible crash during write to disk error
  • Loading branch information
LePresidente authored Aug 22, 2018
2 parents 364289d + 258bddb commit 2232bdf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/downloadmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1845,11 +1845,12 @@ void DownloadManager::writeData(DownloadInfo *info)
if (info != nullptr) {
qint64 ret = info->m_Output.write(info->m_Reply->readAll());
if (ret < info->m_Reply->size()) {
QString fileName = info->m_FileName; // m_FileName may be destroyed after setState
setState(info, DownloadState::STATE_CANCELED);
qCritical(QString("Unable to write download \"%2\" to drive (return %1)").arg(ret).arg(info->m_FileName).toLocal8Bit());
reportError(tr("Unable to write download to drive (return %1).\n"
"Check the drive's available storage.\n\n"
"Canceling download \"%2\"...").arg(ret).arg(info->m_FileName));
"Canceling download \"%2\"...").arg(ret).arg(fileName));
}
}
}

0 comments on commit 2232bdf

Please sign in to comment.