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

Unverified Commit 3f59748b authored by Madhanraj Chelladurai's avatar Madhanraj Chelladurai Committed by Michael Bestas
Browse files

axolotl: 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
parent eeabb812
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -182,7 +182,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) {
@@ -190,9 +190,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)
@@ -208,7 +211,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();
}