Bluetooth: GATT: Fix iterating over requested handle range
If handle is over the range end return since handles are always placed in ascending order. Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
4154f27ab5
commit
755a6e503e
1 changed files with 6 additions and 2 deletions
|
@ -946,9 +946,13 @@ void bt_gatt_foreach_attr(u16_t start_handle, u16_t end_handle,
|
|||
for (i = 0; i < svc->attr_count; i++) {
|
||||
struct bt_gatt_attr *attr = &svc->attrs[i];
|
||||
|
||||
/* Stop if over the requested range */
|
||||
if (attr->handle > end_handle) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check if attribute handle is within range */
|
||||
if (attr->handle < start_handle ||
|
||||
attr->handle > end_handle) {
|
||||
if (attr->handle < start_handle) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue