1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 03:32:16 -05:00

fix potential NPE

This commit is contained in:
Art O Cathain 2015-06-13 15:29:58 +01:00
parent e01b1b189f
commit 2d45e53739

View File

@ -1183,41 +1183,40 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
if (menuInfo != null) { if (menuInfo != null) {
mSelectedContextAccount = (BaseAccount)getListView().getItemAtPosition(menuInfo.position); mSelectedContextAccount = (BaseAccount)getListView().getItemAtPosition(menuInfo.position);
} }
Account realAccount = null;
if (mSelectedContextAccount instanceof Account) { if (mSelectedContextAccount instanceof Account) {
realAccount = (Account)mSelectedContextAccount; Account realAccount = (Account)mSelectedContextAccount;
} switch (item.getItemId()) {
switch (item.getItemId()) { case R.id.delete_account:
case R.id.delete_account: onDeleteAccount(realAccount);
onDeleteAccount(realAccount); break;
break; case R.id.account_settings:
case R.id.account_settings: onEditAccount(realAccount);
onEditAccount(realAccount); break;
break; case R.id.activate:
case R.id.activate: onActivateAccount(realAccount);
onActivateAccount(realAccount); break;
break; case R.id.clear_pending:
case R.id.clear_pending: onClearCommands(realAccount);
onClearCommands(realAccount); break;
break; case R.id.empty_trash:
case R.id.empty_trash: onEmptyTrash(realAccount);
onEmptyTrash(realAccount); break;
break; case R.id.clear:
case R.id.clear: onClear(realAccount);
onClear(realAccount); break;
break; case R.id.recreate:
case R.id.recreate: onRecreate(realAccount);
onRecreate(realAccount); break;
break; case R.id.export:
case R.id.export: onExport(false, realAccount);
onExport(false, realAccount); break;
break; case R.id.move_up:
case R.id.move_up: onMove(realAccount, true);
onMove(realAccount, true); break;
break; case R.id.move_down:
case R.id.move_down: onMove(realAccount, false);
onMove(realAccount, false); break;
break; }
} }
return true; return true;
} }