diff options
author | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2011-09-13 13:33:31 (GMT) |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2011-09-13 15:30:28 (GMT) |
commit | 71bcd941d577097ca99900554386c9f12d4353e3 (patch) | |
tree | c0680974127ea16119c800b1589af8c3088d4211 /src/network | |
parent | 695ef14f443ef992f62203949fc1565b11fdf621 (diff) | |
download | Qt-71bcd941d577097ca99900554386c9f12d4353e3.zip Qt-71bcd941d577097ca99900554386c9f12d4353e3.tar.gz Qt-71bcd941d577097ca99900554386c9f12d4353e3.tar.bz2 |
Add missing checks for httpReply in QNetworkHttpBackend.
httpReply is not guaranteed to be non-null. Adding missing checks for methods
that can be called from outside the class.
Reviewed-By: Peter Hartmann
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qnetworkaccesshttpbackend.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index abef8ab..aa477fb 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -737,7 +737,7 @@ void QNetworkAccessHttpBackend::readFromHttp() void QNetworkAccessHttpBackend::replyFinished() { - if (httpReply->bytesAvailable()) + if (!httpReply || httpReply->bytesAvailable()) // we haven't read everything yet. Wait some more. return; @@ -788,6 +788,9 @@ void QNetworkAccessHttpBackend::checkForRedirect(const int statusCode) void QNetworkAccessHttpBackend::replyHeaderChanged() { + if (!httpReply) + return; + setAttribute(QNetworkRequest::HttpPipeliningWasUsedAttribute, httpReply->isPipeliningUsed()); // reconstruct the HTTP header @@ -1128,7 +1131,7 @@ bool QNetworkAccessHttpBackend::canResume() const return false; // Can only resume if server/resource supports Range header. - if (httpReply->headerField("Accept-Ranges", "none") == "none") + if (!httpReply || httpReply->headerField("Accept-Ranges", "none") == "none") return false; // We only support resuming for byte ranges. |