Fix parsing service records with an empty service classes list
Current code would segfault if it encounters a service record with an
empty service classes list. This patch fixes it.
diff --git a/src/device.c b/src/device.c
index 7551111..63f35de 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1217,6 +1217,12 @@
if (sdp_get_service_classes(rec, &svcclass) < 0)
continue;
+ /* Check for empty service classes list */
+ if (svcclass == NULL) {
+ debug("Skipping record with no service classes");
+ continue;
+ }
+
/* Extract the first element and skip the remainning */
profile_uuid = bt_uuid2string(svcclass->data);
if (!profile_uuid) {