qget test - fix null pointer dereference
authorShane Kearns <ext-shane.2.kearns@nokia.com>
Thu, 7 Jun 2012 14:26:29 +0000 (15:26 +0100)
committerQt by Nokia <qt-info@nokia.com>
Tue, 26 Jun 2012 22:46:35 +0000 (00:46 +0200)
If the server sends a redirect with no body, the file is null

Change-Id: I49fd1d8a4cdd404497ebef4c7f3b478960776896
Reviewed-by: Richard J. Moore <rich@kde.org>
tests/manual/qnetworkaccessmanager/qget/transferitem.cpp

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