diff --git a/src/net/skora/eccardinfos/ECCardInfosActivity.java b/src/net/skora/eccardinfos/ECCardInfosActivity.java index c05a030..427bfed 100644 --- a/src/net/skora/eccardinfos/ECCardInfosActivity.java +++ b/src/net/skora/eccardinfos/ECCardInfosActivity.java @@ -85,6 +85,7 @@ public void onCreate(Bundle savedInstanceState) { nfc = NfcAdapter.getDefaultAdapter(this); if (nfc == null) { showDialog(DIALOG_NFC_NOT_AVAIL); + return; } nfcintent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); } @@ -92,13 +93,17 @@ public void onCreate(Bundle savedInstanceState) { @Override protected void onResume() { super.onResume(); - nfc.enableForegroundDispatch(this, nfcintent, null, nfctechfilter); + if(nfc != null){ + nfc.enableForegroundDispatch(this, nfcintent, null, nfctechfilter); + } } @Override protected void onPause() { super.onPause(); - nfc.disableForegroundDispatch(this); + if(nfc != null){ + nfc.disableForegroundDispatch(this); + } } protected void onNewIntent(Intent intent) { @@ -312,4 +317,4 @@ protected void log(String msg) { protected void toastError(CharSequence msg) { Toast.makeText(this, msg, Toast.LENGTH_LONG).show(); } -} \ No newline at end of file +}