Skip to content

Commit 964df6d

Browse files
Thalleycarlescufi
authored andcommitted
Bluetooth: Audio: Add conn check for MICS client notify handler
Add a NULL check for the conn pointer. Signed-off-by: Emil Gydesen <[email protected]>
1 parent 1f60adf commit 964df6d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

subsys/bluetooth/audio/mics_client.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,13 @@ static uint8_t mute_notify_handler(struct bt_conn *conn,
6060
const void *data, uint16_t length)
6161
{
6262
uint8_t *mute_val;
63-
struct bt_mics *mics_inst = &mics_insts[bt_conn_index(conn)];
63+
struct bt_mics *mics_inst;
64+
65+
if (conn == NULL) {
66+
return BT_GATT_ITER_CONTINUE;
67+
}
68+
69+
mics_inst = &mics_insts[bt_conn_index(conn)];
6470

6571
if (data != NULL) {
6672
if (length == sizeof(*mute_val)) {

0 commit comments

Comments
 (0)