[Connectivity Report] Fixed crash if signalStrengths is empty.
BUG: 449276
This commit is contained in:
parent
19b8249ed1
commit
ef0efc360f
1 changed files with 10 additions and 8 deletions
|
@ -41,17 +41,19 @@ bool ConnectivityReportPlugin::receivePacket(const NetworkPacket& np)
|
||||||
{
|
{
|
||||||
if (np.type() == PACKET_TYPE_CONNECTIVITY_REPORT) {
|
if (np.type() == PACKET_TYPE_CONNECTIVITY_REPORT) {
|
||||||
auto subscriptions = np.get<QVariantMap>(QStringLiteral("signalStrengths"), QVariantMap());
|
auto subscriptions = np.get<QVariantMap>(QStringLiteral("signalStrengths"), QVariantMap());
|
||||||
auto networkInfo = subscriptions.first().toMap();
|
if (!subscriptions.isEmpty()) {
|
||||||
|
auto networkInfo = subscriptions.first().toMap();
|
||||||
|
|
||||||
const auto oldCellularNetworkType = m_cellularNetworkType;
|
const auto oldCellularNetworkType = m_cellularNetworkType;
|
||||||
const auto oldNetworkStrength = m_cellularNetworkStrength;
|
const auto oldNetworkStrength = m_cellularNetworkStrength;
|
||||||
|
|
||||||
m_cellularNetworkType = networkInfo.value(QStringLiteral("networkType")).toString();
|
m_cellularNetworkType = networkInfo.value(QStringLiteral("networkType")).toString();
|
||||||
m_cellularNetworkStrength = networkInfo.value(QStringLiteral("signalStrength")).toInt();
|
m_cellularNetworkStrength = networkInfo.value(QStringLiteral("signalStrength")).toInt();
|
||||||
|
|
||||||
if (oldCellularNetworkType != m_cellularNetworkType ||
|
if (oldCellularNetworkType != m_cellularNetworkType ||
|
||||||
oldNetworkStrength != m_cellularNetworkStrength) {
|
oldNetworkStrength != m_cellularNetworkStrength) {
|
||||||
Q_EMIT refreshed(m_cellularNetworkType, m_cellularNetworkStrength);
|
Q_EMIT refreshed(m_cellularNetworkType, m_cellularNetworkStrength);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue