From a346cfb29af432e3e8a2391ace89ce1d0464465a Mon Sep 17 00:00:00 2001 From: Marcin Kajor Date: Thu, 29 Aug 2024 11:10:41 +0200 Subject: [PATCH] [nrfconnect] Fix the case when the Wi-Fi info cannot be retrieved Don't pass uninitialized WiFiInfo object to the OnNetworkingStatusChange() callback in case the GetWiFiInfo() fails. Use GetWantedNetwork() return value as a fallback. Signed-off-by: Marcin Kajor --- src/platform/nrfconnect/wifi/NrfWiFiDriver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform/nrfconnect/wifi/NrfWiFiDriver.cpp b/src/platform/nrfconnect/wifi/NrfWiFiDriver.cpp index 0cf1b383d295ad..616027d605f96e 100644 --- a/src/platform/nrfconnect/wifi/NrfWiFiDriver.cpp +++ b/src/platform/nrfconnect/wifi/NrfWiFiDriver.cpp @@ -143,7 +143,7 @@ void NrfWiFiDriver::OnNetworkConnStatusChanged(const wifi_conn_status & connStat ssid = WiFiManager::Instance().GetWantedNetwork().ssid; ssidLen = WiFiManager::Instance().GetWantedNetwork().ssidLen; } - mpNetworkStatusChangeCallback->OnNetworkingStatusChange(status, MakeOptional(ByteSpan(wifiInfo.mSsid, wifiInfo.mSsidLen)), + mpNetworkStatusChangeCallback->OnNetworkingStatusChange(status, MakeOptional(ByteSpan(ssid, ssidLen)), connStatus ? MakeOptional(static_cast(connStatus)) : NullOptional); }