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

Commit 4ecf41f1 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

leaudio: Fix getting first device.

Before returning first device, make sure weak_ptr is not expired.

Bug: 216734398
Test: atest bluetooth_le_audio_test
Change-Id: I2cf1d6447c759b88c7483869db67927fc480501d
parent 9d718b1d
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -106,7 +106,10 @@ void LeAudioDeviceGroup::Deactivate(void) {
}

LeAudioDevice* LeAudioDeviceGroup::GetFirstDevice(void) {
  return (leAudioDevices_.front().lock()).get();
  auto d = leAudioDevices_.front();
  if (d.expired()) return nullptr;

  return (d.lock()).get();
}

LeAudioDevice* LeAudioDeviceGroup::GetFirstDeviceWithActiveContext(