Skip to content

Commit

Permalink
[Infineon] Fix the Network information does not restore back if fails…
Browse files Browse the repository at this point in the history
…afe is set to 0 (project-chip#22473)

* Check value size before cleaning config value.
  • Loading branch information
AlvinHsiao authored and isiu-apple committed Sep 16, 2022
1 parent 413984d commit 22bfb7b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/platform/Infineon/CYW30739/KeyValueStoreManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 22bfb7b

Please sign in to comment.