From f6c947fef644f56cddb942c41e9a2b007753fe03 Mon Sep 17 00:00:00 2001 From: Marcin Kajor <98948394+markaj-nordic@users.noreply.github.com> Date: Fri, 30 Aug 2024 23:29:04 +0200 Subject: [PATCH] [nrf fromtree] [nrfconnect] Fix the case when the Wi-Fi info cannot be retrieved (#35275) 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); }