Bluetooth: Audio: Add missing null check for ep idle state
The endpoint will likely be in the idle state when we first read the ASE state. In that case we have not yet attached a stream to the endpoint, and thus should not request the stream to be released when it is NULL. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
29f043707f
commit
777a5801ea
1 changed files with 8 additions and 3 deletions
|
@ -240,11 +240,16 @@ static void unicast_client_ep_idle_state(struct bt_audio_ep *ep,
|
||||||
struct net_buf_simple *buf)
|
struct net_buf_simple *buf)
|
||||||
{
|
{
|
||||||
struct bt_audio_stream *stream = ep->stream;
|
struct bt_audio_stream *stream = ep->stream;
|
||||||
|
const struct bt_audio_stream_ops *ops;
|
||||||
|
|
||||||
|
if (stream == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Notify upper layer */
|
/* Notify upper layer */
|
||||||
if (stream != NULL && stream->ops != NULL &&
|
ops = stream->ops;
|
||||||
stream->ops->released != NULL) {
|
if (ops != NULL && ops->released != NULL) {
|
||||||
stream->ops->released(stream);
|
ops->released(stream);
|
||||||
} else {
|
} else {
|
||||||
BT_WARN("No callback for released set");
|
BT_WARN("No callback for released set");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue