Skip to content

Commit ad34317

Browse files
authored
[controller] fix 30260 (project-chip#30864)
1 parent 575d600 commit ad34317

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

src/controller/AutoCommissioner.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -828,10 +828,10 @@ CHIP_ERROR AutoCommissioner::CommissioningStepFinished(CHIP_ERROR err, Commissio
828828
return NOCChainGenerated(report.Get<NocChain>().noc, report.Get<NocChain>().icac, report.Get<NocChain>().rcac,
829829
report.Get<NocChain>().ipk, report.Get<NocChain>().adminSubject);
830830
case CommissioningStage::kICDGetRegistrationInfo:
831-
// Noting to od. The ICD registation info is handled elsewhere.
831+
// Noting to do. The ICD registation info is handled elsewhere.
832832
break;
833833
case CommissioningStage::kICDRegistration:
834-
// Noting to od. DevicePairingDelegate will handle this.
834+
// Noting to do. DevicePairingDelegate will handle this.
835835
break;
836836
case CommissioningStage::kICDSendStayActive:
837837
// Nothing to do.

src/controller/CHIPDeviceController.cpp

+14-8
Original file line numberDiff line numberDiff line change
@@ -1177,19 +1177,25 @@ void DeviceCommissioner::OnICDManagementRegisterClientResponse(
11771177
void * context, const app::Clusters::IcdManagement::Commands::RegisterClientResponse::DecodableType & data)
11781178
{
11791179
DeviceCommissioner * commissioner = static_cast<DeviceCommissioner *>(context);
1180+
VerifyOrReturn(commissioner != nullptr, ChipLogProgress(Controller, "Command response callback with null context. Ignoring"));
11801181

1181-
CommissioningDelegate::CommissioningReport report;
1182-
auto pairingDelegate = commissioner->GetPairingDelegate();
1183-
auto deviceBeingCommissioned = commissioner->mDeviceBeingCommissioned;
1184-
if (pairingDelegate != nullptr && deviceBeingCommissioned != nullptr)
1182+
if (commissioner->mCommissioningStage != CommissioningStage::kICDRegistration)
11851183
{
1186-
pairingDelegate->OnICDRegistrationComplete(deviceBeingCommissioned->GetDeviceId(), data.ICDCounter);
1187-
commissioner->CommissioningStageComplete(CHIP_NO_ERROR, report);
1184+
return;
11881185
}
1189-
else
1186+
1187+
if (commissioner->mDeviceBeingCommissioned == nullptr)
11901188
{
1191-
commissioner->CommissioningStageComplete(CHIP_ERROR_INCORRECT_STATE, report);
1189+
return;
11921190
}
1191+
1192+
if (commissioner->mPairingDelegate != nullptr)
1193+
{
1194+
commissioner->mPairingDelegate->OnICDRegistrationComplete(commissioner->mDeviceBeingCommissioned->GetDeviceId(),
1195+
data.ICDCounter);
1196+
}
1197+
CommissioningDelegate::CommissioningReport report;
1198+
commissioner->CommissioningStageComplete(CHIP_NO_ERROR, report);
11931199
}
11941200

11951201
bool DeviceCommissioner::ExtendArmFailSafe(DeviceProxy * proxy, CommissioningStage step, uint16_t armFailSafeTimeout,

0 commit comments

Comments
 (0)