Skip to content

Commit

Permalink
Fix merge error causing test failures. (#14773)
Browse files Browse the repository at this point in the history
Merging #14487
violated the API contract that was established in
#14688, so we
started failing tests.  The two PRs had never been run through CI
together.
  • Loading branch information
bzbarsky-apple authored Feb 4, 2022
1 parent 44c2895 commit 1fafe32
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/credentials/FabricTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,10 +601,17 @@ CHIP_ERROR FabricTable::Delete(FabricIndex index)
bool fabricIsInitialized = fabric != nullptr && fabric->IsInitialized();
CompressedFabricId compressedFabricId =
fabricIsInitialized ? fabric->GetPeerId().GetCompressedFabricId() : kUndefinedCompressedFabricId;
ReturnErrorOnFailure(FabricInfo::DeleteFromStorage(mStorage, index)); // Delete from storage regardless
CHIP_ERROR err = FabricInfo::DeleteFromStorage(mStorage, index); // Delete from storage regardless
if (!fabricIsInitialized)
{
// Make sure to return the error our API promises, not whatever storage
// chose to return.
return CHIP_ERROR_NOT_FOUND;
}
ReturnErrorOnFailure(err);

ReleaseFabricIndex(index);
if (mDelegate != nullptr && fabricIsInitialized)
if (mDelegate != nullptr)
{
if (mFabricCount == 0)
{
Expand All @@ -622,10 +629,6 @@ CHIP_ERROR FabricTable::Delete(FabricIndex index)
delegate = delegate->mNext;
}
}
if (!fabricIsInitialized)
{
return CHIP_ERROR_NOT_FOUND;
}
return CHIP_NO_ERROR;
}

Expand Down

0 comments on commit 1fafe32

Please sign in to comment.