Fix NPE in NfcHandler
Bug: 5115848 Change-Id: I8e581aa77363bc1f33eb3267be5c924fba772aae
This commit is contained in:
parent
36aef9fb74
commit
2208f5dce9
@ -16,15 +16,13 @@
|
|||||||
|
|
||||||
package com.android.email.activity;
|
package com.android.email.activity;
|
||||||
|
|
||||||
import com.android.emailcommon.provider.Account;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
|
||||||
import android.nfc.NdefMessage;
|
import android.nfc.NdefMessage;
|
||||||
import android.nfc.NdefRecord;
|
import android.nfc.NdefRecord;
|
||||||
import android.nfc.NfcAdapter;
|
import android.nfc.NfcAdapter;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
|
||||||
|
import com.android.emailcommon.provider.Account;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
@ -42,7 +40,6 @@ public class NfcHandler implements NfcAdapter.NdefPushCallback {
|
|||||||
private UIControllerBase mUiController;
|
private UIControllerBase mUiController;
|
||||||
private Activity mActivity;
|
private Activity mActivity;
|
||||||
private String mCurrentEmail;
|
private String mCurrentEmail;
|
||||||
private static final String TAG = "ContactsNfcHandler";
|
|
||||||
|
|
||||||
public NfcHandler(UIControllerBase controller, Activity
|
public NfcHandler(UIControllerBase controller, Activity
|
||||||
activity) {
|
activity) {
|
||||||
@ -54,8 +51,8 @@ public class NfcHandler implements NfcAdapter.NdefPushCallback {
|
|||||||
public void onAccountChanged() {
|
public void onAccountChanged() {
|
||||||
if (mUiController.isActualAccountSelected()) {
|
if (mUiController.isActualAccountSelected()) {
|
||||||
final long accountId = mUiController.getActualAccountId();
|
final long accountId = mUiController.getActualAccountId();
|
||||||
final Account account = Account.restoreAccountWithId(
|
final Account account = Account.restoreAccountWithId(mActivity, accountId);
|
||||||
mActivity, accountId);
|
if (account == null) return;
|
||||||
mCurrentEmail = account.mEmailAddress;
|
mCurrentEmail = account.mEmailAddress;
|
||||||
} else {
|
} else {
|
||||||
mCurrentEmail = null;
|
mCurrentEmail = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user