From e4d0f6da247ca647bd5754cc0152fb9d2689bda9 Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Thu, 25 Apr 2024 11:15:37 +0800 Subject: [PATCH] ui/network: add error handling for refreshFinished (#32167) old-commit-hash: 3bcb6f82afa47405d70a3cfd6bfe7eab2fceb1b4 --- selfdrive/ui/qt/network/wifi_manager.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/selfdrive/ui/qt/network/wifi_manager.cc b/selfdrive/ui/qt/network/wifi_manager.cc index 0c50d02f4fe1d9..c7991990eb21f1 100644 --- a/selfdrive/ui/qt/network/wifi_manager.cc +++ b/selfdrive/ui/qt/network/wifi_manager.cc @@ -99,10 +99,20 @@ void WifiManager::refreshFinished(QDBusPendingCallWatcher *watcher) { seenNetworks.clear(); const QDBusReply> watcher_reply = *watcher; + if (!watcher_reply.isValid()) { + qCritical() << "Failed to refresh"; + watcher->deleteLater(); + return; + } + for (const QDBusObjectPath &path : watcher_reply.value()) { QDBusReply 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;