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

Commit 1b844065 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

csis: Fix for assert on missing csis instance

Bug: 150670922
Tag: #feature
Sponsor: jpawlowski@
Test: atest --host bluetooth_csis_test

Change-Id: Id95b18a94ea4d0ee03d59d305e94cd3d25f2a17e
parent faca4a77
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -658,7 +658,19 @@ class CsisClientImpl : public CsisClient {

      int group_id = csis_group->GetGroupId();
      auto csis_instance = device->GetCsisInstanceByGroupId(group_id);
      LOG_ASSERT(csis_instance) << " csis_instance does not exist!";
      LOG(ERROR) << __func__ << " group id " << group_id;

      if (!csis_instance) {
        /* This can happen when some other user added device to group in the
         * context which is not existing on the peer side. e.g. LeAudio added it
         * in the CAP context, but CSIS exist on the peer device without a
         * context. We will endup in having device in 2 groups. One in generic
         * context with valid csis_instance, and one in CAP context without csis
         * instance */
        LOG(INFO) << __func__ << " csis_instance does not exist for group "
                  << group_id;
        continue;
      }

      callbacks_->OnDeviceAvailable(device->addr, group_id,
                                    csis_group->GetDesiredSize(),