diff --git a/gps/android/utils/battery_listener.cpp b/gps/android/utils/battery_listener.cpp index 9cbfabdc..a6a498e4 100644 --- a/gps/android/utils/battery_listener.cpp +++ b/gps/android/utils/battery_listener.cpp @@ -184,13 +184,14 @@ BatteryListenerImpl::~BatteryListenerImpl() { { std::lock_guard _l(mLock); - if (mHealth != NULL) + if (mHealth != NULL) { mHealth->unregisterCallback(this); auto r = mHealth->unlinkToDeath(this); if (!r.isOk() || r == false) { LOC_LOGe("Transaction error in unregister to HealthHAL death: %s", r.description().c_str()); } + } } mDone = true; mThread->join();