From 18d7052dd348746b300e97c363a5403862a8548d Mon Sep 17 00:00:00 2001 From: deanlee Date: Thu, 11 Apr 2024 23:07:30 +0800 Subject: [PATCH] add error handling --- 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 111726330d6035..a80a217b632c24 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> wather_reply = *watcher; + if (!wather_reply.isValid()) { + qCritical() << "Failed to refresh."; + watcher->deleteLater(); + return; + } + for (const QDBusObjectPath &path : wather_reply.value()) { QDBusReply 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;