diff options
author | Nick Pelly <npelly@google.com> | 2011-11-14 19:39:27 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-11-14 19:39:27 -0800 |
commit | f4226b69c9e19d0329069b39d8ae2774fcbf88d1 (patch) | |
tree | cfe2dcde2165847f90d56fcc2cf6422969e08cfe /src/com/android | |
parent | ebf4b36e17dd0a63f293a618a6d1bcea98a69bd3 (diff) | |
parent | 0571ce53451baf7d363703b6e3ac10bc885fc5bc (diff) | |
download | packages_apps_nfc-f4226b69c9e19d0329069b39d8ae2774fcbf88d1.zip packages_apps_nfc-f4226b69c9e19d0329069b39d8ae2774fcbf88d1.tar.gz packages_apps_nfc-f4226b69c9e19d0329069b39d8ae2774fcbf88d1.tar.bz2 |
Merge "Add null check to aovid NPE on un-matched close()." into ics-mr1
Diffstat (limited to 'src/com/android')
-rwxr-xr-x | src/com/android/nfc/NfcService.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java index a4a63f5..152c5fb 100755 --- a/src/com/android/nfc/NfcService.java +++ b/src/com/android/nfc/NfcService.java @@ -1126,7 +1126,7 @@ public class NfcService extends Application implements DeviceHostListener { //TODO: This is incorrect behavior - the close should interrupt pending // operations. However this is not supported by current hardware. - synchronized(NfcService.this) { + synchronized (NfcService.this) { if (!isNfcEnabled()) { throw new IOException("NFC adapter is disabled"); } @@ -1206,7 +1206,11 @@ public class NfcService extends Application implements DeviceHostListener { public Bundle close(String pkg, IBinder b) throws RemoteException { NfcService.this.enforceNfceeAdminPerm(pkg); - b.unlinkToDeath(mOpenEe, 0); + synchronized (this) { + if (mOpenEe != null) { + b.unlinkToDeath(mOpenEe, 0); + } + } Bundle result; try { @@ -1239,7 +1243,7 @@ public class NfcService extends Application implements DeviceHostListener { if (!isNfcEnabled()) { throw new IOException("NFC is not enabled"); } - if (mOpenEe == null){ + if (mOpenEe == null) { throw new IOException("NFC EE is not open"); } if (getCallingPid() != mOpenEe.pid) { |