@@ -1177,19 +1177,25 @@ void DeviceCommissioner::OnICDManagementRegisterClientResponse(
1177
1177
void * context, const app::Clusters::IcdManagement::Commands::RegisterClientResponse::DecodableType & data)
1178
1178
{
1179
1179
DeviceCommissioner * commissioner = static_cast <DeviceCommissioner *>(context);
1180
+ VerifyOrReturn (commissioner != nullptr , ChipLogProgress (Controller, " Command response callback with null context. Ignoring" ));
1180
1181
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 )
1185
1183
{
1186
- pairingDelegate->OnICDRegistrationComplete (deviceBeingCommissioned->GetDeviceId (), data.ICDCounter );
1187
- commissioner->CommissioningStageComplete (CHIP_NO_ERROR, report);
1184
+ return ;
1188
1185
}
1189
- else
1186
+
1187
+ if (commissioner->mDeviceBeingCommissioned == nullptr )
1190
1188
{
1191
- commissioner-> CommissioningStageComplete (CHIP_ERROR_INCORRECT_STATE, report) ;
1189
+ return ;
1192
1190
}
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);
1193
1199
}
1194
1200
1195
1201
bool DeviceCommissioner::ExtendArmFailSafe (DeviceProxy * proxy, CommissioningStage step, uint16_t armFailSafeTimeout,
0 commit comments