Skip to content

Commit 63b7360

Browse files
Nick PellyAndroid (Google) Code Review
authored andcommitted
Merge "Fix NPE on devices that don't have NFC." into ics-mr1
2 parents 1733a3d + a5193b2 commit 63b7360

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/java/android/nfc/NfcAdapter.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,10 @@ public static NfcAdapter getDefaultAdapter(Context context) {
360360
/* use getSystemService() instead of just instantiating to take
361361
* advantage of the context's cached NfcManager & NfcAdapter */
362362
NfcManager manager = (NfcManager) context.getSystemService(Context.NFC_SERVICE);
363+
if (manager == null) {
364+
// NFC not available
365+
return null;
366+
}
363367
return manager.getDefaultAdapter();
364368
}
365369

0 commit comments

Comments
 (0)