Skip to content

Commit 2232bdf

Browse files
authored
Merge pull request #497 from Modorganizer2/Develop
Fix possible crash during write to disk error
2 parents 364289d + 258bddb commit 2232bdf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/downloadmanager.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1845,11 +1845,12 @@ void DownloadManager::writeData(DownloadInfo *info)
18451845
if (info != nullptr) {
18461846
qint64 ret = info->m_Output.write(info->m_Reply->readAll());
18471847
if (ret < info->m_Reply->size()) {
1848+
QString fileName = info->m_FileName; // m_FileName may be destroyed after setState
18481849
setState(info, DownloadState::STATE_CANCELED);
18491850
qCritical(QString("Unable to write download \"%2\" to drive (return %1)").arg(ret).arg(info->m_FileName).toLocal8Bit());
18501851
reportError(tr("Unable to write download to drive (return %1).\n"
18511852
"Check the drive's available storage.\n\n"
1852-
"Canceling download \"%2\"...").arg(ret).arg(info->m_FileName));
1853+
"Canceling download \"%2\"...").arg(ret).arg(fileName));
18531854
}
18541855
}
18551856
}

0 commit comments

Comments
 (0)