Merge "Fix NPE on devices that don't have NFC." into ics-mr1

This commit is contained in:
Nick Pelly
2011-11-17 12:48:48 -08:00
committed by Android (Google) Code Review

View File

@@ -360,6 +360,10 @@ public final class NfcAdapter {
/* use getSystemService() instead of just instantiating to take
* advantage of the context's cached NfcManager & NfcAdapter */
NfcManager manager = (NfcManager) context.getSystemService(Context.NFC_SERVICE);
if (manager == null) {
// NFC not available
return null;
}
return manager.getDefaultAdapter();
}