Skip to content

Commit

Permalink
[nrfconnect] Fix the case when the Wi-Fi info cannot be retrieved
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
markaj-nordic committed Aug 29, 2024
1 parent 4cdce52 commit f4a7965
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/platform/nrfconnect/wifi/NrfWiFiDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int32_t>(connStatus))
: NullOptional);
}
Expand Down

0 comments on commit f4a7965

Please sign in to comment.