summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Chang <georgekgchang@google.com>2022-10-28 15:17:34 +0800
committerGeorge Chang <georgekgchang@google.com>2022-10-31 07:17:54 +0000
commit8bc03cdeb0b2f5766c20c2e220cf0bada87070b3 (patch)
treed98fc8b9d70438916351adca611497820a8a3810
parent310dfcf764628f8a87e82abfcf7f9e79a0d0f8d7 (diff)
downloadNfc-8bc03cdeb0b2f5766c20c2e220cf0bada87070b3.tar.gz
Fix NullPointerException if device don't support NFC
Bug: 256072559 Test: NfcNciInstrumentationTests Merger-In: I263f335834f75d933b30b3c408d0bff186e4ed75 Change-Id: I263f335834f75d933b30b3c408d0bff186e4ed75
-rw-r--r--tests/unit/src/com/android/nfc/NfcStateTest.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/unit/src/com/android/nfc/NfcStateTest.java b/tests/unit/src/com/android/nfc/NfcStateTest.java
index 26f93a4b..50b8eea2 100644
--- a/tests/unit/src/com/android/nfc/NfcStateTest.java
+++ b/tests/unit/src/com/android/nfc/NfcStateTest.java
@@ -86,7 +86,7 @@ public final class NfcStateTest {
@After
public void tearDown() throws Exception {
mContext.unregisterReceiver(mAdapterStateChangedReceiver);
- if (mNfcAdapter.isControllerAlwaysOnSupported()) {
+ if (mNfcSupported && mNfcAdapter.isControllerAlwaysOnSupported()) {
mNfcAdapter.unregisterControllerAlwaysOnListener(mListener);
}
}