Skip to content

Commit 1f60adf

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

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

subsys/bluetooth/services/ots/ots_client.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,13 @@ uint8_t bt_ots_client_indicate_handler(struct bt_conn *conn,
349349
const void *data, uint16_t length)
350350
{
351351
uint16_t handle = params->value_handle;
352-
struct bt_otc_internal_instance_t *inst =
353-
lookup_inst_by_handle(handle);
352+
struct bt_otc_internal_instance_t *inst;
353+
354+
if (conn == NULL) {
355+
return BT_GATT_ITER_CONTINUE;
356+
}
357+
358+
inst = lookup_inst_by_handle(handle);
354359

355360
/* TODO: Can we somehow avoid exposing this
356361
* callback via the public API?

0 commit comments

Comments
 (0)