From 025e0bfcd1fa9463cbf16218d7e3927c1fa92b42 Mon Sep 17 00:00:00 2001 From: Zang MingJie Date: Thu, 24 Mar 2022 19:25:19 +0800 Subject: [PATCH] Skip calling OnFabricRetrievedFromStorage when the fabric is already initialized --- src/credentials/FabricTable.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/credentials/FabricTable.cpp b/src/credentials/FabricTable.cpp index e5b1fc37f95bdc..dbc3dcf9072121 100644 --- a/src/credentials/FabricTable.cpp +++ b/src/credentials/FabricTable.cpp @@ -618,15 +618,15 @@ CHIP_ERROR FabricTable::LoadFromStorage(FabricInfo * fabric) if (!fabric->IsInitialized()) { ReturnErrorOnFailure(fabric->LoadFromStorage(mStorage)); - } - FabricTableDelegate * delegate = mDelegate; - while (delegate) - { - ChipLogProgress(Discovery, "Fabric (%d) loaded from storage. Calling OnFabricRetrievedFromStorage", - fabric->GetFabricIndex()); - delegate->OnFabricRetrievedFromStorage(fabric); - delegate = delegate->mNext; + FabricTableDelegate * delegate = mDelegate; + while (delegate) + { + ChipLogProgress(Discovery, "Fabric (%d) loaded from storage. Calling OnFabricRetrievedFromStorage", + fabric->GetFabricIndex()); + delegate->OnFabricRetrievedFromStorage(fabric); + delegate = delegate->mNext; + } } return CHIP_NO_ERROR; }