Skip to content

Commit 3c80212

Browse files
[zephyr] Fixed error check in BLE manager impl
The error check for rand address generation is done after the address is set, what is too late.
1 parent 48adf65 commit 3c80212

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/platform/Zephyr/BLEManagerImpl.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,15 @@ int InitRandomStaticAddress(bool idPresent, int & id)
122122
// generating the address
123123
addr.type = BT_ADDR_LE_RANDOM;
124124
error = sys_csrand_get(addr.a.val, sizeof(addr.a.val));
125-
BT_ADDR_SET_STATIC(&addr.a);
126125

127126
if (error)
128127
{
129128
ChipLogError(DeviceLayer, "Failed to create BLE address: %d", error);
130129
return error;
131130
}
132131

132+
BT_ADDR_SET_STATIC(&addr.a);
133+
133134
if (!idPresent)
134135
{
135136
id = bt_id_create(&addr, nullptr);

0 commit comments

Comments
 (0)