Commit 39e63117 authored by Johan Hedberg's avatar Johan Hedberg
Browse files

Bluetooth: drivers/nble: Fix passing NULL to attr->read()



We should be looking up the appropriate connection object and passing
that to the callback.

Change-Id: I04620b301541c8bda45f20e2b1dcca8f71562821
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent 847703d9
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1190,7 +1190,13 @@ void on_nble_gatts_read_evt(const struct nble_gatt_rd_evt *ev)
	memset(&reply_data, 0, sizeof(reply_data));

	if (attr->read) {
		len = attr->read(NULL, attr, data, sizeof(data), ev->offset);
		struct bt_conn *conn = bt_conn_lookup_handle(ev->conn_handle);

		len = attr->read(conn, attr, data, sizeof(data), ev->offset);

		if (conn) {
			bt_conn_unref(conn);
		}
	} else {
		len = BT_GATT_ERR(BT_ATT_ERR_NOT_SUPPORTED);
	}