qget test - fix null pointer dereference

If the server sends a redirect with no body, the file is null

Change-Id: I49fd1d8a4cdd404497ebef4c7f3b478960776896
Reviewed-by: Richard J. Moore <rich@kde.org>
This commit is contained in:
Shane Kearns 2012-06-07 15:26:29 +01:00 committed by Qt by Nokia
parent 74d3963c25
commit a32d6834ad

View File

@ -122,7 +122,7 @@ void DownloadItem::finished()
qDebug() << "too many redirects"; qDebug() << "too many redirects";
} else { } else {
//follow redirect //follow redirect
if (outputFile->isOpen()) { if (outputFile && outputFile->isOpen()) {
if (!outputFile->seek(0) || !outputFile->resize(0)) { if (!outputFile->seek(0) || !outputFile->resize(0)) {
outputFile->close(); outputFile->close();
outputFile->remove(); outputFile->remove();