Skip to content

Commit

Permalink
ui/network: add error handling for refreshFinished (commaai#32167)
Browse files Browse the repository at this point in the history
  • Loading branch information
deanlee authored Apr 25, 2024
1 parent 06c4a54 commit 3bcb6f8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion selfdrive/ui/qt/network/wifi_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,20 @@ void WifiManager::refreshFinished(QDBusPendingCallWatcher *watcher) {
seenNetworks.clear();

const QDBusReply<QList<QDBusObjectPath>> watcher_reply = *watcher;
if (!watcher_reply.isValid()) {
qCritical() << "Failed to refresh";
watcher->deleteLater();
return;
}

for (const QDBusObjectPath &path : watcher_reply.value()) {
QDBusReply<QVariantMap> reply = call(path.path(), NM_DBUS_INTERFACE_PROPERTIES, "GetAll", NM_DBUS_INTERFACE_ACCESS_POINT);
auto properties = reply.value();
if (!reply.isValid()) {
qCritical() << "Failed to retrieve properties for path:" << path.path();
continue;
}

auto properties = reply.value();
const QByteArray ssid = properties["Ssid"].toByteArray();
if (ssid.isEmpty()) continue;

Expand Down

0 comments on commit 3bcb6f8

Please sign in to comment.