Diff between 1d4d0d81277db276f7b03c495751015740a68d50 and b22a2596433ec2ff862b5efc103de0bb35e5a041

Changed Files

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

Full Patch

diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index 8083ff7..1285c37 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -1212,7 +1212,9 @@ static void complete_notify_request(void *data)
 	struct notify_data *notify_data = data;
 
 	notify_data->att_id = 0;
-	notify_data->callback(0, notify_data->user_data);
+
+	if (notify_data->callback)
+		notify_data->callback(0, notify_data->user_data);
 }
 
 static bool notify_data_write_ccc(struct notify_data *notify_data, bool enable,
@@ -3157,6 +3159,10 @@ bool bt_gatt_client_unregister_notify(struct bt_gatt_client *client,
 	/* Remove data if it has been queued */
 	queue_remove(notify_data->chrc->reg_notify_queue, notify_data);
 
+	/* Reset callbacks */
+	notify_data->callback = NULL;
+	notify_data->notify = NULL;
+
 	complete_unregister_notify(notify_data);
 	return true;
 }