From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx> This checks the return of gatt_db_get_attribute and fail if return NULL. --- src/gatt-client.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gatt-client.c b/src/gatt-client.c index 8f67db3..608f96d 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, -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html