diff --git a/gps/android/utils/battery_listener.cpp b/gps/android/utils/battery_listener.cpp index a6a498e4..64ce2c8e 100644 --- a/gps/android/utils/battery_listener.cpp +++ b/gps/android/utils/battery_listener.cpp @@ -194,7 +194,9 @@ BatteryListenerImpl::~BatteryListenerImpl() } } mDone = true; - mThread->join(); + if (NULL != mThread) { + mThread->join(); + } } void BatteryListenerImpl::serviceDied(uint64_t cookie __unused, @@ -211,7 +213,9 @@ void BatteryListenerImpl::serviceDied(uint64_t cookie __unused, } mHealth = NULL; mCond.notify_one(); - mThread->join(); + if (NULL != mThread) { + mThread->join(); + } std::lock_guard _l(mLock); init(); }