summaryrefslogtreecommitdiffstats
path: root/network/wirednetworkmodel.cpp
diff options
context:
space:
mode:
authorRaquel Medina <raquel.medina@konsulko.com>2019-07-18 23:59:08 +0200
committerRaquel Medina <raquel.medina@konsulko.com>2019-07-19 01:39:38 +0200
commit61d01475342f6811458d1ae70c23aeaed5348143 (patch)
tree39a2d5a387cd311d75d43012ec1104374f4689fb /network/wirednetworkmodel.cpp
parent9d2600f4b4dcbdd3820910967eb00a9b00cd8a17 (diff)
libqtappfw: network: improve error checks
- include extra checks for error conditions - remove some tabs and unused variable Bug-AGL: SPEC-2636 Signed-off-by: Raquel Medina <raquel.medina@konsulko.com> Change-Id: I28b38c77979175236a7b115a0f4263840c70eb94
Diffstat (limited to 'network/wirednetworkmodel.cpp')
-rw-r--r--network/wirednetworkmodel.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/network/wirednetworkmodel.cpp b/network/wirednetworkmodel.cpp
index d14bce4..eb8988b 100644
--- a/network/wirednetworkmodel.cpp
+++ b/network/wirednetworkmodel.cpp
@@ -9,8 +9,13 @@ WiredNetworkModel::WiredNetworkModel(QObject *parent)
QVariant WiredNetworkModel::data(const QModelIndex &index, int role) const
{
+ QVariant ret;
+
+ if (!index.isValid())
+ return ret;
+
if (index.row() < 0 || index.row() >= m_networks.count())
- return QVariant();
+ return ret;
const ConnectionProfile *network = m_networks[index.row()];
@@ -25,7 +30,7 @@ QVariant WiredNetworkModel::data(const QModelIndex &index, int role) const
return network->state();
}
- return QVariant();
+ return ret;
}
QHash<int, QByteArray> WiredNetworkModel::roleNames() const {