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

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

leaudio: Fix possible crash

At this point group should exist. If not, let's catch the log and
just set device as disconnected

Bug: 279046914
Tag: #feature
Test: manual
Change-Id: I22bd53b4e36533df54eee1a44f3890613795c40e
parent 9295e681
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2117,6 +2117,12 @@ class LeAudioClientImpl : public LeAudioClient {
             ADDRESS_TO_LOGGABLE_CSTR(leAudioDevice->address_),
             leAudioDevice->autoconnect_flag_, reason);

    if (group == nullptr) {
      LOG_ERROR("Group id %d is null", leAudioDevice->group_id_);
      leAudioDevice->SetConnectionState(DeviceConnectState::DISCONNECTED);
      return;
    }

    if (reason != GATT_CONN_TERMINATE_LOCAL_HOST ||
        leAudioDevice->autoconnect_flag_) {
      leAudioDevice->SetConnectionState(