shared/gatt-client: add NULL check to discover_secondary_cb()
It is necessary to prevent dereferencing of a NULL pointer.
Found with the SVACE static analysis tool.
diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index b48d739..9db3f52 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -1276,7 +1276,9 @@
range = queue_peek_head(op->discov_ranges);
- client->discovery_req = bt_gatt_discover_included_services(client->att,
+ if (range)
+ client->discovery_req = bt_gatt_discover_included_services(
+ client->att,
range->start,
range->end,
discover_incl_cb,