From 93fedbb9e07af3539ddc9e7ae999ce46ed19d943 Mon Sep 17 00:00:00 2001 From: Michael Janssen Date: Tue, 10 Feb 2015 12:16:17 -0800 Subject: [PATCH] shared/gatt-client: Skip discovery with no handles If there are no handles in a defined service, it is not useful to try to discover anything in it, just go to the next service. --- src/shared/gatt-client.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c index d0fc05495..bfb9427f9 100644 --- a/src/shared/gatt-client.c +++ b/src/shared/gatt-client.c @@ -525,6 +525,9 @@ next: if (!gatt_db_attribute_get_service_handles(attr, &start, &end)) goto failed; + if (start == end) + goto next; + if (bt_gatt_discover_included_services(client->att, start, end, discover_incl_cb, discovery_op_ref(op), @@ -675,6 +678,9 @@ next: if (!gatt_db_attribute_get_service_handles(attr, &start, &end)) goto failed; + if (start == end) + goto next; + /* Move on to the next service */ op->cur_svc = attr; if (bt_gatt_discover_characteristics(client->att, start, end, @@ -776,6 +782,9 @@ next: if (!gatt_db_attribute_get_service_handles(attr, &start, &end)) goto failed; + if (start == end) + goto next; + /* Move on to the next service */ op->cur_svc = attr; if (bt_gatt_discover_characteristics(client->att, start, end, -- 2.47.3