summaryrefslogtreecommitdiffstats
path: root/src/network/access/qnetworkreplyimpl.cpp
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2010-02-03 23:16:19 (GMT)
committerAaron McCarthy <aaron.mccarthy@nokia.com>2010-02-08 07:45:07 (GMT)
commit68d510148615b5fb4d3b6ce5faa516c110c53d58 (patch)
treec7890b19e909c4d488eaa43307c19899f84692ce /src/network/access/qnetworkreplyimpl.cpp
parent92eac408783fd4b1e2db2759c3212b580ff24205 (diff)
downloadQt-68d510148615b5fb4d3b6ce5faa516c110c53d58.zip
Qt-68d510148615b5fb4d3b6ce5faa516c110c53d58.tar.gz
Qt-68d510148615b5fb4d3b6ce5faa516c110c53d58.tar.bz2
Only create session when valid configuration is available.
Only create a network session when a valid configuration is available. Don't execute session code if a network session has not been created.
Diffstat (limited to 'src/network/access/qnetworkreplyimpl.cpp')
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index fbe90ef..72c378a 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -89,13 +89,18 @@ void QNetworkReplyImplPrivate::_q_startOperation()
// state changes.
state = WaitingForSession;
- if (!manager->d_func()->session->isOpen())
- manager->d_func()->session->open();
+ QNetworkSession *session = manager->d_func()->session;
+
+ if (session) {
+ if (!session->isOpen())
+ session->open();
+ } else {
+ qWarning("Backend is waiting for QNetworkSession to connect, but there is none!");
+ }
return;
}
- //backend->open();
if (state != Finished) {
if (operation == QNetworkAccessManager::GetOperation)
pendingNotifications.append(NotifyDownstreamReadyWrite);
@@ -516,8 +521,9 @@ void QNetworkReplyImplPrivate::finished()
pauseNotificationHandling();
QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader);
- if (state == Working && errorCode != QNetworkReply::OperationCanceledError &&
- manager->d_func()->session->state() == QNetworkSession::Roaming) {
+ QNetworkSession *session = manager->d_func()->session;
+ 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()) {
qDebug() << "Connection broke during download.";