Skip to content

Commit f8d457a

Browse files
authored
ESP32: report network status change only when IM engine and the data model provider is ready (project-chip#36939)
* ESP32: report network status change only when the data model provider is set * skip gn check for the interaction model engine include line
1 parent 621b9c9 commit f8d457a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/platform/ESP32/NetworkCommissioningDriver.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18+
#include <app/InteractionModelEngine.h> // nogncheck
1819
#include <lib/support/CodeUtils.h>
1920
#include <lib/support/SafeInt.h>
2021
#include <platform/CHIPDeviceLayer.h>
@@ -458,6 +459,9 @@ void ESPWiFiDriver::OnScanWiFiNetworkDone()
458459

459460
void ESPWiFiDriver::OnNetworkStatusChange()
460461
{
462+
// This function reports the status to the data model provider, so skip it if the provider is not ready.
463+
VerifyOrReturn(app::InteractionModelEngine::GetInstance() &&
464+
app::InteractionModelEngine::GetInstance()->GetDataModelProvider());
461465
Network configuredNetwork;
462466
bool staEnabled = false, staConnected = false;
463467
VerifyOrReturn(ESP32Utils::IsStationEnabled(staEnabled) == CHIP_NO_ERROR);

0 commit comments

Comments
 (0)