Commit ef0efc36 authored by Michael Prager's avatar Michael Prager Committed by Albert Vaca Cintora
Browse files

[Connectivity Report] Fixed crash if signalStrengths is empty.

BUG: 449276
parent 19b8249e
Pipeline #148735 passed with stage
in 3 minutes and 31 seconds
......@@ -41,17 +41,19 @@ bool ConnectivityReportPlugin::receivePacket(const NetworkPacket& np)
{
if (np.type() == PACKET_TYPE_CONNECTIVITY_REPORT) {
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 oldNetworkStrength = m_cellularNetworkStrength;
const auto oldCellularNetworkType = m_cellularNetworkType;
const auto oldNetworkStrength = m_cellularNetworkStrength;
m_cellularNetworkType = networkInfo.value(QStringLiteral("networkType")).toString();
m_cellularNetworkStrength = networkInfo.value(QStringLiteral("signalStrength")).toInt();
m_cellularNetworkType = networkInfo.value(QStringLiteral("networkType")).toString();
m_cellularNetworkStrength = networkInfo.value(QStringLiteral("signalStrength")).toInt();
if (oldCellularNetworkType != m_cellularNetworkType ||
oldNetworkStrength != m_cellularNetworkStrength) {
Q_EMIT refreshed(m_cellularNetworkType, m_cellularNetworkStrength);
if (oldCellularNetworkType != m_cellularNetworkType ||
oldNetworkStrength != m_cellularNetworkStrength) {
Q_EMIT refreshed(m_cellularNetworkType, m_cellularNetworkStrength);
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment