am c8f1c814: Merge "Prevent NPE in account deletion race condition" into honeycomb

* commit 'c8f1c814cd7dbdb7ed3dffe0ec8a096713ee4d08':
  Prevent NPE in account deletion race condition
This commit is contained in:
Andy Stadler 2011-01-28 11:36:08 -08:00 committed by Android Git Automerger
commit 57fa4995c2

View File

@ -333,7 +333,7 @@ public class AccountSettingsXL extends PreferenceActivity {
int headerCount = mAccountListHeaders.length;
for (int index = 0; index < headerCount; index++) {
Header header = mAccountListHeaders[index];
if (header.id != HEADER_ID_UNDEFINED) {
if (header != null && header.id != HEADER_ID_UNDEFINED) {
if (header.id != mDeletingAccountId) {
target.add(header);
if (header.id == mRequestedAccountId) {
@ -381,6 +381,9 @@ public class AccountSettingsXL extends PreferenceActivity {
* This AsyncTask reads the accounts list and generates the headers. When the headers are
* ready, we'll trigger PreferenceActivity to refresh the account list with them.
*
* The array generated and stored in mAccountListHeaders may be sparse so any readers should
* check for and skip over null entries, and should not assume array length is # of accounts.
*
* TODO: Smaller projection
* TODO: Convert to Loader
* TODO: Write a test, including operation of deletingAccountId param