Merge "Prevent NPE in account deletion race condition" into honeycomb

This commit is contained in:
Andy Stadler 2011-01-28 11:33:34 -08:00 committed by Android (Google) Code Review
commit c8f1c814cd
1 changed files with 4 additions and 1 deletions

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