Skip to content

Commit

Permalink
add error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
deanlee committed Apr 11, 2024
1 parent 70b8e27 commit 18d7052
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>> wather_reply = *watcher;
if (!wather_reply.isValid()) {
qCritical() << "Failed to refresh.";
watcher->deleteLater();
return;
}

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

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

Expand Down

0 comments on commit 18d7052

Please sign in to comment.