QNetworkAccessManager: check if networksession is set

Need to check that the networkSession has been set so we don't
crash when bearermanagement is enabled.

Task-number: QTBUG-23484
Change-Id: Ifdb71350ba5b4ddbdbd17a8d87189c78c524783e
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
This commit is contained in:
Martin Petersson 2012-01-06 09:51:53 +01:00 committed by Qt by Nokia
parent b328e36e41
commit 5bdd20a085

View File

@ -1050,14 +1050,16 @@ void QHttpNetworkConnectionPrivate::startNetworkLayerStateLookup()
int timeout = 300;
#ifndef QT_NO_BEARERMANAGEMENT
if (networkSession->configuration().bearerType() == QNetworkConfiguration::Bearer2G)
timeout = 800;
else if (networkSession->configuration().bearerType() == QNetworkConfiguration::BearerCDMA2000)
timeout = 500;
else if (networkSession->configuration().bearerType() == QNetworkConfiguration::BearerWCDMA)
timeout = 500;
else if (networkSession->configuration().bearerType() == QNetworkConfiguration::BearerHSPA)
timeout = 400;
if (networkSession) {
if (networkSession->configuration().bearerType() == QNetworkConfiguration::Bearer2G)
timeout = 800;
else if (networkSession->configuration().bearerType() == QNetworkConfiguration::BearerCDMA2000)
timeout = 500;
else if (networkSession->configuration().bearerType() == QNetworkConfiguration::BearerWCDMA)
timeout = 500;
else if (networkSession->configuration().bearerType() == QNetworkConfiguration::BearerHSPA)
timeout = 400;
}
#endif
delayedConnectionTimer.start(timeout);
if (delayIpv4)