From e6310300e3ea01d7ae89e81db221ff8f0cb2e66d Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 3 Jun 2021 17:07:26 -0700 Subject: [PATCH] btdev: Fix crash when generating disconnected event for BIS When generating disconnected event for a BIS it would not have any link as the ISO is in fact we are broadcasting and don't have an ACL. --- emulator/btdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/emulator/btdev.c b/emulator/btdev.c index 13abad577..dd4661a10 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -614,8 +614,10 @@ static int cmd_disconnect_complete(struct btdev *dev, const void *data, } disconnect_complete(dev, conn->handle, BT_HCI_ERR_SUCCESS, cmd->reason); - disconnect_complete(conn->link->dev, conn->link->handle, - BT_HCI_ERR_SUCCESS, cmd->reason); + + if (conn->link) + disconnect_complete(conn->link->dev, conn->link->handle, + BT_HCI_ERR_SUCCESS, cmd->reason); conn_remove(conn); -- 2.47.3