Diff between 76d1b4232c994d79d9935b51fce3debdd19ba0a1 and ca9bc90b7467f27c8172b46895fa5754ef08416f

Changed Files

File Additions Deletions Status
src/gatt-client.c +7 -0 modified

Full Patch

diff --git a/src/gatt-client.c b/src/gatt-client.c
index 6a9a1df..863492a 100644
--- a/src/gatt-client.c
+++ b/src/gatt-client.c
@@ -1339,8 +1339,15 @@ static struct characteristic *characteristic_create(
 	gatt_db_attribute_get_char_data(attr, &chrc->handle,
 							&chrc->value_handle,
 							&chrc->props, &uuid);
+
 	chrc->attr = gatt_db_get_attribute(service->client->db,
 							chrc->value_handle);
+	if (!chrc->attr) {
+		error("Attribute 0x%04x not found", chrc->value_handle);
+		characteristic_free(chrc);
+		return NULL;
+	}
+
 	bt_uuid_to_uuid128(&uuid, &chrc->uuid);
 
 	chrc->path = g_strdup_printf("%s/char%04x", service->path,