Commit d515cf29 authored by Joakim Andersson's avatar Joakim Andersson Committed by Anas Nashif
Browse files

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: default avatarJoakim Andersson <joakim.andersson@nordicsemi.no>
parent 1ebe7581
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1166,9 +1166,9 @@ static u8_t find_next(const struct bt_gatt_attr *attr, void *user_data)
struct bt_gatt_attr *bt_gatt_attr_next(const struct bt_gatt_attr *attr)
{
	struct bt_gatt_attr *next = NULL;
	u16_t handle = attr->handle ? : find_static_attr(attr);

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

	return next;
}