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

Commit 50bc186c authored by Natalie Silvanovich's avatar Natalie Silvanovich Committed by Android (Google) Code Review
Browse files

Merge "NULL check in registerListener"

parents fa9cc91e 3e6d3319
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -43,6 +43,8 @@ void BatteryPropertiesRegistrar::notifyListeners(struct BatteryProperties props)

void BatteryPropertiesRegistrar::registerListener(const sp<IBatteryPropertiesListener>& listener) {
    {
        if (listener == NULL)
            return;
        Mutex::Autolock _l(mRegistrationLock);
        // check whether this is a duplicate
        for (size_t i = 0; i < mListeners.size(); i++) {
@@ -58,6 +60,8 @@ void BatteryPropertiesRegistrar::registerListener(const sp<IBatteryPropertiesLis
}

void BatteryPropertiesRegistrar::unregisterListener(const sp<IBatteryPropertiesListener>& listener) {
    if (listener == NULL)
        return;
    Mutex::Autolock _l(mRegistrationLock);
    for (size_t i = 0; i < mListeners.size(); i++) {
        if (mListeners[i]->asBinder() == listener->asBinder()) {