From 61d01475342f6811458d1ae70c23aeaed5348143 Mon Sep 17 00:00:00 2001 From: Raquel Medina Date: Thu, 18 Jul 2019 23:59:08 +0200 Subject: 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 Change-Id: I28b38c77979175236a7b115a0f4263840c70eb94 --- network/wirednetworkmodel.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'network/wirednetworkmodel.cpp') 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 WiredNetworkModel::roleNames() const { -- cgit 1.2.3-korg