summaryrefslogtreecommitdiffstats
path: root/src/plugins/bearer/connman
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@jollamobile.com>2014-05-15 09:07:07 +1000
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-22 13:12:13 +0200
commitd86af6e4b63b1038c92a61ae29dcada787c49c41 (patch)
treeb2693798952daed56099cf59409b0b4067f4db50 /src/plugins/bearer/connman
parent297be273a34b33cf19af0fb2d2bec6df8d3809b6 (diff)
fix crash in connman bearer backend when accessing null objects
Change-Id: Ib199b4093d86d1596b630223d0734171ba0d82c5 Reviewed-by: Lorn Potter <lorn.potter@jollamobile.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'src/plugins/bearer/connman')
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp
index 0903496472..5e3aaae072 100644
--- a/src/plugins/bearer/connman/qconnmanengine.cpp
+++ b/src/plugins/bearer/connman/qconnmanengine.cpp
@@ -186,7 +186,7 @@ void QConnmanEngine::connectToId(const QString &id)
QConnmanServiceInterface *serv = connmanServiceInterfaces.value(id);
- if (!serv->isValid()) {
+ if (!serv || !serv->isValid()) {
emit connectionError(id, QBearerEngineImpl::InterfaceLookupError);
} else {
if (serv->type() == QLatin1String("cellular")) {
@@ -211,7 +211,7 @@ void QConnmanEngine::disconnectFromId(const QString &id)
QMutexLocker locker(&mutex);
QConnmanServiceInterface *serv = connmanServiceInterfaces.value(id);
- if (!serv->isValid()) {
+ if (!serv || !serv->isValid()) {
emit connectionError(id, DisconnectionError);
} else {
serv->disconnect();
@@ -263,6 +263,8 @@ QNetworkSession::State QConnmanEngine::sessionStateForId(const QString &id)
QString service = id;
QConnmanServiceInterface *serv = connmanServiceInterfaces.value(service);
+ if (!serv)
+ return QNetworkSession::Invalid;
QString servState = serv->state();
@@ -368,6 +370,8 @@ void QConnmanEngine::serviceStateChanged(const QString &state)
void QConnmanEngine::configurationChange(QConnmanServiceInterface *serv)
{
+ if (!serv)
+ return;
QMutexLocker locker(&mutex);
QString id = serv->path();
@@ -409,8 +413,10 @@ QNetworkConfiguration::StateFlags QConnmanEngine::getStateForService(const QStri
{
QMutexLocker locker(&mutex);
QConnmanServiceInterface *serv = connmanServiceInterfaces.value(service);
- QString state = serv->state();
+ if (!serv)
+ return QNetworkConfiguration::Undefined;
+ QString state = serv->state();
QNetworkConfiguration::StateFlags flag = QNetworkConfiguration::Defined;
if (serv->type() == QLatin1String("cellular")) {