Skip to content

Commit

Permalink
Fix gattlib_connection_is_connected
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviermartin committed Apr 8, 2024
1 parent 5406a97 commit 2d771d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions common/gattlib_common_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 2d771d9

Please sign in to comment.