From 305f240dc12325af4fa267e7c4f52c680bb05280 Mon Sep 17 00:00:00 2001 From: Syed Ibrahim M Date: Tue, 19 Jun 2012 10:14:25 -0700 Subject: [PATCH] handle NullPointerException in cases where a proxy call to AdapterService is called after Adapter Service is stopped. Change-Id: I009787f03f9a013b9b06fcb7e3f6241c850f8cd2 --- core/java/android/bluetooth/BluetoothDevice.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java index 25047632ce378..4cc22b4ae909b 100755 --- a/core/java/android/bluetooth/BluetoothDevice.java +++ b/core/java/android/bluetooth/BluetoothDevice.java @@ -786,6 +786,12 @@ public final class BluetoothDevice implements Parcelable { try { return sService.getBondState(this); } catch (RemoteException e) {Log.e(TAG, "", e);} + catch (NullPointerException npe) { + // Handle case where bluetooth service proxy + // is already null. + Log.e(TAG, "NullPointerException for getBondState() of device ("+ + getAddress()+")", npe); + } return BOND_NONE; }