From f8d457a446456d5df1e750e728ea48e8fce9d989 Mon Sep 17 00:00:00 2001 From: Wang Qixiang <43193572+wqx6@users.noreply.github.com> Date: Tue, 7 Jan 2025 10:12:11 +0800 Subject: [PATCH] ESP32: report network status change only when IM engine and the data model provider is ready (#36939) * ESP32: report network status change only when the data model provider is set * skip gn check for the interaction model engine include line --- src/platform/ESP32/NetworkCommissioningDriver.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/platform/ESP32/NetworkCommissioningDriver.cpp b/src/platform/ESP32/NetworkCommissioningDriver.cpp index 1ded189218ce82..77394d17f4e49a 100644 --- a/src/platform/ESP32/NetworkCommissioningDriver.cpp +++ b/src/platform/ESP32/NetworkCommissioningDriver.cpp @@ -15,6 +15,7 @@ * limitations under the License. */ +#include // nogncheck #include #include #include @@ -458,6 +459,9 @@ void ESPWiFiDriver::OnScanWiFiNetworkDone() void ESPWiFiDriver::OnNetworkStatusChange() { + // This function reports the status to the data model provider, so skip it if the provider is not ready. + VerifyOrReturn(app::InteractionModelEngine::GetInstance() && + app::InteractionModelEngine::GetInstance()->GetDataModelProvider()); Network configuredNetwork; bool staEnabled = false, staConnected = false; VerifyOrReturn(ESP32Utils::IsStationEnabled(staEnabled) == CHIP_NO_ERROR);