From 77d57d07a97b60633d2fe76acc11a845c0850674 Mon Sep 17 00:00:00 2001 From: Jason Monk Date: Wed, 16 Dec 2015 14:26:18 -0500 Subject: [PATCH] Protect against crash when no NfcAdapter is around Bug: 26155716 Change-Id: I9e10831ca068263b40fcf06bf83ce341d73e96d2 --- src/com/android/settings/nfc/PaymentSettings.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/nfc/PaymentSettings.java b/src/com/android/settings/nfc/PaymentSettings.java index 985a1e698ae..dc7badf5a5c 100644 --- a/src/com/android/settings/nfc/PaymentSettings.java +++ b/src/com/android/settings/nfc/PaymentSettings.java @@ -19,6 +19,7 @@ package com.android.settings.nfc; import android.app.Activity; import android.content.Context; import android.content.Intent; +import android.nfc.NfcAdapter; import android.os.Bundle; import android.support.v7.preference.PreferenceManager; import android.support.v7.preference.PreferenceScreen; @@ -111,7 +112,7 @@ public class PaymentSettings extends SettingsPreferenceFragment { @Override public void setListening(boolean listening) { - if (listening) { + if (listening && NfcAdapter.getDefaultAdapter(mContext) != null) { PaymentBackend paymentBackend = new PaymentBackend(mContext); paymentBackend.refresh(); PaymentAppInfo app = paymentBackend.getDefaultApp();