From 1578fe475fa2148735b6cd8122cf4d92731b979d Mon Sep 17 00:00:00 2001 From: Adrian Smith Date: Sun, 16 Sep 2012 17:27:56 +0100 Subject: [PATCH] Ensure accnt is not null before attemting to edit In some unknown scenario's it can be null and cause an NPE --- src/com/u17od/upm/AccountsList.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/com/u17od/upm/AccountsList.java b/src/com/u17od/upm/AccountsList.java index f8b341b..499a076 100644 --- a/src/com/u17od/upm/AccountsList.java +++ b/src/com/u17od/upm/AccountsList.java @@ -120,10 +120,12 @@ private void editAccount(AccountInformation ai) { if (Utilities.isSyncRequired(this)) { UIUtilities.showToast(this, R.string.sync_required); } else { - Intent i = new Intent(AccountsList.this, AddEditAccount.class); - i.putExtra(AddEditAccount.MODE, AddEditAccount.EDIT_MODE); - i.putExtra(AddEditAccount.ACCOUNT_TO_EDIT, ai.getAccountName()); - startActivityForResult(i, AddEditAccount.EDIT_ACCOUNT_REQUEST_CODE); + if (ai != null) { + Intent i = new Intent(AccountsList.this, AddEditAccount.class); + i.putExtra(AddEditAccount.MODE, AddEditAccount.EDIT_MODE); + i.putExtra(AddEditAccount.ACCOUNT_TO_EDIT, ai.getAccountName()); + startActivityForResult(i, AddEditAccount.EDIT_ACCOUNT_REQUEST_CODE); + } } }