summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2010-02-16 01:21:28 (GMT)
committerAaron McCarthy <aaron.mccarthy@nokia.com>2010-02-16 01:21:28 (GMT)
commit13a880f23b01856770a3afc12b1a47121ef04349 (patch)
treea1d7160d2cf55d37ac07307446d6e631d5ec8200 /src/network
parent4f7dc1642d66850deed0395f8b713af7a21d8957 (diff)
downloadQt-13a880f23b01856770a3afc12b1a47121ef04349.zip
Qt-13a880f23b01856770a3afc12b1a47121ef04349.tar.gz
Qt-13a880f23b01856770a3afc12b1a47121ef04349.tar.bz2
Fix segfault.
manager may be 0.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index 8951d08..2175686 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -549,21 +549,24 @@ void QNetworkReplyImplPrivate::finished()
QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader);
if (preMigrationDownloaded != Q_INT64_C(-1))
totalSize = totalSize.toLongLong() + preMigrationDownloaded;
- QNetworkSession *session = manager->d_func()->networkSession;
- if (session && session->state() == QNetworkSession::Roaming &&
- state == Working && errorCode != QNetworkReply::OperationCanceledError) {
- // only content with a known size will fail with a temporary network failure error
- if (!totalSize.isNull()) {
- if (bytesDownloaded != totalSize) {
- if (migrateBackend()) {
- // either we are migrating or the request is finished/aborted
- if (state == Reconnecting || state == WaitingForSession) {
- resumeNotificationHandling();
- return; // exit early if we are migrating.
+
+ if (!manager.isNull()) {
+ QNetworkSession *session = manager->d_func()->networkSession;
+ if (session && session->state() == QNetworkSession::Roaming &&
+ state == Working && errorCode != QNetworkReply::OperationCanceledError) {
+ // only content with a known size will fail with a temporary network failure error
+ if (!totalSize.isNull()) {
+ if (bytesDownloaded != totalSize) {
+ if (migrateBackend()) {
+ // either we are migrating or the request is finished/aborted
+ if (state == Reconnecting || state == WaitingForSession) {
+ resumeNotificationHandling();
+ return; // exit early if we are migrating.
+ }
+ } else {
+ error(QNetworkReply::TemporaryNetworkFailureError,
+ q->tr("Temporary network failure."));
}
- } else {
- error(QNetworkReply::TemporaryNetworkFailureError,
- q->tr("Temporary network failure."));
}
}
}