am dfb7bc8c: Merge change 26821 into eclair

Merge commit 'dfb7bc8c87d8fe694164038cf292c9913fae9bdb' into eclair-plus-aosp

* commit 'dfb7bc8c87d8fe694164038cf292c9913fae9bdb':
  Make removeOnAccountsUpdateListener cope with null handlers.
This commit is contained in:
Bryan Mawhinney
2009-09-24 14:38:58 -07:00
committed by Android Git Automerger

View File

@@ -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);
}