sm8350-common: gps: Add NULL check before object access
Correct the NULL check code block and add NULL check before object access. Change-Id: Ic41b781b41fb4e21bbff8801d500a41a6d7219d0 CRs-fixed: 3084543
This commit is contained in:
parent
f09da84023
commit
a20d1da042
@ -184,7 +184,7 @@ BatteryListenerImpl::~BatteryListenerImpl()
|
||||
{
|
||||
{
|
||||
std::lock_guard<std::mutex> _l(mLock);
|
||||
if (mHealth != NULL)
|
||||
if (mHealth != NULL) {
|
||||
mHealth->unregisterCallback(this);
|
||||
auto r = mHealth->unlinkToDeath(this);
|
||||
if (!r.isOk() || r == false) {
|
||||
@ -192,9 +192,12 @@ BatteryListenerImpl::~BatteryListenerImpl()
|
||||
r.description().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
mDone = true;
|
||||
if (NULL != mThread) {
|
||||
mThread->join();
|
||||
}
|
||||
}
|
||||
|
||||
void BatteryListenerImpl::serviceDied(uint64_t cookie __unused,
|
||||
const wp<hidl::base::V1_0::IBase>& who)
|
||||
@ -210,7 +213,9 @@ void BatteryListenerImpl::serviceDied(uint64_t cookie __unused,
|
||||
}
|
||||
mHealth = NULL;
|
||||
mCond.notify_one();
|
||||
if (NULL != mThread) {
|
||||
mThread->join();
|
||||
}
|
||||
std::lock_guard<std::mutex> _l(mLock);
|
||||
init();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user