diff --git a/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp b/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp index d6d28e189d821c..f798054932e692 100644 --- a/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp @@ -278,6 +278,15 @@ void SlWiFiDriver::OnScanWiFiNetworkDone(wfx_wifi_scan_result_t * aScanResult) { if (GetInstance().mpScanCallback != nullptr) { + if (mScanResponseIter.Count() == 0) + { + // if there is no network found, return kNetworkNotFound + DeviceLayer::SystemLayer().ScheduleLambda([]() { + GetInstance().mpScanCallback->OnFinished(NetworkCommissioning::Status::kNetworkNotFound, CharSpan(), nullptr); + GetInstance().mpScanCallback = nullptr; + }); + return; + } DeviceLayer::SystemLayer().ScheduleLambda([]() { GetInstance().mpScanCallback->OnFinished(NetworkCommissioning::Status::kSuccess, CharSpan(), &mScanResponseIter); GetInstance().mpScanCallback = nullptr;