Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2468)

Unified Diff: device/nfc/android/java/src/org/chromium/device/nfc/NfcImpl.java

Issue 2292353002: Fix NFC crasher from accessing a destroyed activity. (Closed)
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/android/eclipse/.classpath » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/nfc/android/java/src/org/chromium/device/nfc/NfcImpl.java
diff --git a/device/nfc/android/java/src/org/chromium/device/nfc/NfcImpl.java b/device/nfc/android/java/src/org/chromium/device/nfc/NfcImpl.java
index 35a73205968cabea4f543f80833fec2eaa5fdd42..fd6fbdc320430247ecce6abb661a1cc72b2f78a5 100644
--- a/device/nfc/android/java/src/org/chromium/device/nfc/NfcImpl.java
+++ b/device/nfc/android/java/src/org/chromium/device/nfc/NfcImpl.java
@@ -362,11 +362,12 @@ public class NfcImpl implements Nfc {
* Disables reader mode.
* @see android.nfc.NfcAdapter#disableReaderMode
*/
+ @TargetApi(Build.VERSION_CODES.KITKAT)
private void disableReaderMode() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) return;
mReaderCallbackHandler = null;
- if (mActivity != null) {
+ if (mActivity != null && !mActivity.isDestroyed()) {
mNfcAdapter.disableReaderMode(mActivity);
}
}
« no previous file with comments | « no previous file | tools/android/eclipse/.classpath » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698