Fix gattlib_connection_is_connected

pull/277/head
Olivier Martin 2024-04-08 12:57:22 +02:00
parent 5406a97e57
commit 2d771d9390
1 changed files with 2 additions and 2 deletions

View File

@ -110,14 +110,14 @@ struct _connection_is_connected {
static gint _is_device_connection(gconstpointer a, gconstpointer b) {
const gattlib_device_t* device = a;
return (&device->connection == b);
return (&device->connection == b) ? 0 : -1; // We need to return 0 when it matches
}
static void _gattlib_connection_is_connected(gpointer data, gpointer user_data) {
gattlib_adapter_t* adapter = data;
struct _connection_is_connected* connection_is_connected = user_data;
GSList *device_entry = g_slist_find_custom(adapter->devices, user_data, _is_device_connection);
GSList *device_entry = g_slist_find_custom(adapter->devices, connection_is_connected->connection, _is_device_connection);
if (device_entry == NULL) {
return;
}