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

Commit 05a72dac authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

HearingAid RemoveDevice - don't crash when profile not enabled

Bug: 79468820
Test: Unbond non-hearing aid device when profile not enabled
Change-Id: I2a87f8725447045e7bc5b2a33facf1ce14b47c54
parent a4994c7f
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -103,8 +103,13 @@ class HearingAidInterfaceImpl

  void RemoveDevice(const RawAddress& address) override {
    DVLOG(2) << __func__ << " address: " << address;

    // RemoveDevice can be called on devices that don't have HA enabled
    if (HearingAid::IsInitialized()) {
      do_in_bta_thread(FROM_HERE, Bind(&HearingAid::Disconnect,
                                       Unretained(HearingAid::Get()), address));
    }

    do_in_jni_thread(FROM_HERE,
                     Bind(&btif_storage_remove_hearing_aid, address));
  }