From 22bfb7b5c84af5b29486c3dba57c739ed6a01175 Mon Sep 17 00:00:00 2001 From: AlvinHsiao Date: Thu, 15 Sep 2022 21:59:16 +0800 Subject: [PATCH] [Infineon] Fix the Network information does not restore back if failsafe is set to 0 (#22473) * Check value size before cleaning config value. --- .../Infineon/CYW30739/KeyValueStoreManagerImpl.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/platform/Infineon/CYW30739/KeyValueStoreManagerImpl.cpp b/src/platform/Infineon/CYW30739/KeyValueStoreManagerImpl.cpp index a62fffaf57f190..31c01f097095dc 100644 --- a/src/platform/Infineon/CYW30739/KeyValueStoreManagerImpl.cpp +++ b/src/platform/Infineon/CYW30739/KeyValueStoreManagerImpl.cpp @@ -149,8 +149,11 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Delete(const char * key) err = CYW30739Config::ClearConfigValue(entry->GetKeyConfigKey()); VerifyOrExit(ChipError::IsSuccess(err), err = CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); - err = CYW30739Config::ClearConfigValue(entry->GetValueConfigKey()); - VerifyOrExit(ChipError::IsSuccess(err), err = CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + if (entry->GetValueSize() != 0) + { + err = CYW30739Config::ClearConfigValue(entry->GetValueConfigKey()); + VerifyOrExit(ChipError::IsSuccess(err), err = CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + } slist_del(entry, &mKeyConfigIdList); Platform::Delete(entry);