Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dd001c64 authored by Pavlin Radoslavov's avatar Pavlin Radoslavov Committed by Ajay Panicker
Browse files

Add a missing NULL pointer check inside bta_av_rcfg_str_ok()

Apparently, the p_data argument could be NULL if the reconfig
was triggered by the local device.

Test: Tested with Bluetooth headsets
Bug: 35351216
Change-Id: Ic51d849232944b5978772d222c41f66824e14dd4
parent 84b50bc2
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -2564,6 +2564,8 @@ void bta_av_rcfg_str_ok(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
  p_scb->l2c_cid = AVDT_GetL2CapChannel(p_scb->avdt_handle);
  APPL_TRACE_DEBUG("%s: l2c_cid: %d", __func__, p_scb->l2c_cid);

  if (p_data != NULL) {
    // p_data could be NULL if the reconfig was triggered by the local device
    p_scb->stream_mtu =
        p_data->str_msg.msg.open_ind.peer_mtu - AVDT_MEDIA_HDR_SIZE;
    uint16_t mtu = bta_av_chk_mtu(p_scb, p_scb->stream_mtu);
@@ -2571,6 +2573,7 @@ void bta_av_rcfg_str_ok(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
                     p_scb->l2c_cid, p_scb->stream_mtu, mtu);
    if (mtu == 0 || mtu > p_scb->stream_mtu) mtu = p_scb->stream_mtu;
    p_scb->p_cos->update_mtu(p_scb->hndl, mtu);
  }

  /* rc listen */
  bta_av_st_rc_timer(p_scb, NULL);