Skip to content

Commit 1644310

Browse files
cecillepull[bot]
authored andcommitted
Add a check for device != null on commissioning. (#13473)
1 parent d732894 commit 1644310

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/controller/CHIPDeviceController.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,8 @@ CHIP_ERROR DeviceCommissioner::Commission(NodeId remoteDeviceId, CommissioningPa
856856
// TODO(cecille): Can we get rid of mDeviceBeingCommissioned and use the remote id instead? Would require storing the
857857
// commissioning stage in the device.
858858
CommissioneeDeviceProxy * device = mDeviceBeingCommissioned;
859-
if (device->GetDeviceId() != remoteDeviceId || (!device->IsSecureConnected() && !device->IsSessionSetupInProgress()))
859+
if (device == nullptr || device->GetDeviceId() != remoteDeviceId ||
860+
(!device->IsSecureConnected() && !device->IsSessionSetupInProgress()))
860861
{
861862
ChipLogError(Controller, "Invalid device for commissioning" ChipLogFormatX64, ChipLogValueX64(remoteDeviceId));
862863
return CHIP_ERROR_INCORRECT_STATE;

0 commit comments

Comments
 (0)