Skip to content

Commit 8ff183e

Browse files
joerchancarlescufi
authored andcommitted
Bluetooth: GATT: Fix bug in bt_gatt_attr_next unable for static handles
Fix bug in bt_gatt_attr_next when given an attribute that has static allocation. The handle is then 0 and the function would always return the attribute with handle 1. Signed-off-by: Joakim Andersson <[email protected]>
1 parent 23554b0 commit 8ff183e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

subsys/bluetooth/host/gatt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,9 +1306,9 @@ static u8_t find_next(const struct bt_gatt_attr *attr, void *user_data)
13061306
struct bt_gatt_attr *bt_gatt_attr_next(const struct bt_gatt_attr *attr)
13071307
{
13081308
struct bt_gatt_attr *next = NULL;
1309+
u16_t handle = attr->handle ? : find_static_attr(attr);
13091310

1310-
bt_gatt_foreach_attr(attr->handle + 1, attr->handle + 1, find_next,
1311-
&next);
1311+
bt_gatt_foreach_attr(handle + 1, handle + 1, find_next, &next);
13121312

13131313
return next;
13141314
}

0 commit comments

Comments
 (0)