diff options
author | Prerepa Viswanadham <dham@google.com> | 2014-12-04 10:12:55 -0800 |
---|---|---|
committer | Prerepa Viswanadham <dham@google.com> | 2014-12-04 18:30:03 +0000 |
commit | ff5e5db319785d23d672af95ac2dff3f37827cfd (patch) | |
tree | ba6d92a4699b88c001cd8e3fd2acc562dd4b8c77 /core/java/android/bluetooth/BluetoothGatt.java | |
parent | 720beef28dacc924d77576f63fced84e6a820dc6 (diff) | |
download | frameworks_base-ff5e5db319785d23d672af95ac2dff3f37827cfd.zip frameworks_base-ff5e5db319785d23d672af95ac2dff3f37827cfd.tar.gz frameworks_base-ff5e5db319785d23d672af95ac2dff3f37827cfd.tar.bz2 |
Fix BT crash due to unset value for BluetoothGattDescriptor from API user
Validate writeDescriptor and writeCharacteristic methods at API invocation
for non null initialisation.
Bug 18395071
Change-Id: I411a57b77981310d8db1f98c67e03b4327c93339
Diffstat (limited to 'core/java/android/bluetooth/BluetoothGatt.java')
-rw-r--r-- | core/java/android/bluetooth/BluetoothGatt.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/java/android/bluetooth/BluetoothGatt.java b/core/java/android/bluetooth/BluetoothGatt.java index c203a8e..ea2dca0 100644 --- a/core/java/android/bluetooth/BluetoothGatt.java +++ b/core/java/android/bluetooth/BluetoothGatt.java @@ -928,7 +928,7 @@ public final class BluetoothGatt implements BluetoothProfile { BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE) == 0) return false; if (VDBG) Log.d(TAG, "writeCharacteristic() - uuid: " + characteristic.getUuid()); - if (mService == null || mClientIf == 0) return false; + if (mService == null || mClientIf == 0 || characteristic.getValue() == null) return false; BluetoothGattService service = characteristic.getService(); if (service == null) return false; @@ -1015,7 +1015,7 @@ public final class BluetoothGatt implements BluetoothProfile { */ public boolean writeDescriptor(BluetoothGattDescriptor descriptor) { if (VDBG) Log.d(TAG, "writeDescriptor() - uuid: " + descriptor.getUuid()); - if (mService == null || mClientIf == 0) return false; + if (mService == null || mClientIf == 0 || descriptor.getValue() == null) return false; BluetoothGattCharacteristic characteristic = descriptor.getCharacteristic(); if (characteristic == null) return false; |