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

Commit 5be61f5b authored by Bryan Mawhinney's avatar Bryan Mawhinney
Browse files

Make removeOnAccountsUpdateListener cope with null handlers.

Previously, if callers registered OnAccountsUpdateListeners with a null handler,
removeOnAccountsUpdateListener would fail attempting to remove the listener.

Change-Id: If9906d3711f816e60c4b491b7f33671f089ac00f
parent 23703f16
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -859,9 +859,10 @@ public class AccountManager {
            throw new IllegalArgumentException("the listener is null");
        }
        synchronized (mAccountsUpdatedListeners) {
            if (mAccountsUpdatedListeners.remove(listener) == null) {
            if (!mAccountsUpdatedListeners.containsKey(listener)) {
                throw new IllegalStateException("this listener was not previously added");
            }
            mAccountsUpdatedListeners.remove(listener);
            if (mAccountsUpdatedListeners.isEmpty()) {
                mContext.unregisterReceiver(mAccountsChangedBroadcastReceiver);
            }