diff --git a/src/platform/Ameba/AmebaUtils.cpp b/src/platform/Ameba/AmebaUtils.cpp index 4ec66872133429..1d202ccd53f644 100644 --- a/src/platform/Ameba/AmebaUtils.cpp +++ b/src/platform/Ameba/AmebaUtils.cpp @@ -76,6 +76,12 @@ CHIP_ERROR AmebaUtils::EnableStationMode(void) CHIP_ERROR AmebaUtils::SetWiFiConfig(rtw_wifi_config_t * config) { CHIP_ERROR err = CHIP_NO_ERROR; + // don't store if ssid is null + if (config->ssid[0] == 0) + { + return CHIP_NO_ERROR; + } + /* Store Wi-Fi Configurations in Storage */ err = PersistedStorage::KeyValueStoreMgr().Put(kWiFiSSIDKeyName, config->ssid, sizeof(config->ssid)); SuccessOrExit(err); diff --git a/src/platform/Ameba/NetworkCommissioningDriver.h b/src/platform/Ameba/NetworkCommissioningDriver.h index 0303642d3c6396..3942b89627741f 100644 --- a/src/platform/Ameba/NetworkCommissioningDriver.h +++ b/src/platform/Ameba/NetworkCommissioningDriver.h @@ -127,8 +127,8 @@ class AmebaWiFiDriver final : public WiFiDriver bool NetworkMatch(const WiFiNetwork & network, ByteSpan networkId); CHIP_ERROR StartScanWiFiNetworks(ByteSpan ssid); - WiFiNetwork mSavedNetwork; - WiFiNetwork mStagingNetwork; + WiFiNetwork mSavedNetwork = { 0 }; + WiFiNetwork mStagingNetwork = { 0 }; ScanCallback * mpScanCallback; ConnectCallback * mpConnectCallback; NetworkStatusChangeCallback * mpStatusChangeCallback = nullptr;