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

Commit c36d53ef authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by android-build-merger
Browse files

HearingAid RemoveDevice - don't crash when profile not enabled

am: 05a72dac

Change-Id: If3b9cbe1c96ac890c40726c034e71a4314138036
parents 6f82bc94 05a72dac
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));
  }