diff options
author | Nitin Srivastava <nitinsr@codeaurora.org> | 2014-04-09 15:07:29 +0530 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2014-10-11 16:31:43 -0700 |
commit | 5d124df2133c8f073778c79eb2a6aa5cbef22a8a (patch) | |
tree | 7284593d83b6ff22af7d6f339d4fd41a1ba8c692 | |
parent | 5730a8e506cdb1c8e4b911d738cfb7fc16d2889d (diff) | |
download | android_packages_apps_Bluetooth-5d124df2133c8f073778c79eb2a6aa5cbef22a8a.tar.gz android_packages_apps_Bluetooth-5d124df2133c8f073778c79eb2a6aa5cbef22a8a.tar.bz2 android_packages_apps_Bluetooth-5d124df2133c8f073778c79eb2a6aa5cbef22a8a.zip |
Bluetooth: Added null check condtion.
Added null check before accessing
mCurrentDevice. Due to delay in broadcasting
A2dp connection states, Bluetooth settings can
query getConnectedDevices when current state is
disconnected causing NPE.
Change-Id: I2a612e05a3c1a830c9f3bda742bff1b32784e51b
CRs-Fixed: 644148
-rw-r--r-- | src/com/android/bluetooth/a2dp/A2dpStateMachine.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/com/android/bluetooth/a2dp/A2dpStateMachine.java b/src/com/android/bluetooth/a2dp/A2dpStateMachine.java index 516128005..dd70eb19b 100644 --- a/src/com/android/bluetooth/a2dp/A2dpStateMachine.java +++ b/src/com/android/bluetooth/a2dp/A2dpStateMachine.java @@ -726,7 +726,8 @@ final class A2dpStateMachine extends StateMachine { List<BluetoothDevice> getConnectedDevices() { List<BluetoothDevice> devices = new ArrayList<BluetoothDevice>(); synchronized(this) { - if (getCurrentState() == mConnected) { + /* If connected and mCurrentDevice is not null*/ + if ((getCurrentState() == mConnected) && (mCurrentDevice != null)) { devices.add(mCurrentDevice); } } |