am 63b7360e: Merge "Fix NPE on devices that don\'t have NFC." into ics-mr1

* commit '63b7360e9d8c6fb077bdd00c7ef08f402d5a76ba':
  Fix NPE on devices that don't have NFC.
This commit is contained in:
Nick Pelly
2011-11-17 12:51:18 -08:00
committed by Android Git Automerger

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();
}