summaryrefslogtreecommitdiffstats
path: root/core/java/android/bluetooth
diff options
context:
space:
mode:
authorPrerepa Viswanadham <dham@google.com>2014-08-13 14:46:58 -0700
committerPrerepa Viswanadham <dham@google.com>2014-08-14 05:32:06 +0000
commitee3cc8bf177c03ea571a87a73d9ada83201afa63 (patch)
tree4e6ed4c26d8e29a5eb8833cf2c81eaef6433832e /core/java/android/bluetooth
parent347a882de30abdfe30095f084175da2a1e6b2eb2 (diff)
downloadframeworks_base-ee3cc8bf177c03ea571a87a73d9ada83201afa63.zip
frameworks_base-ee3cc8bf177c03ea571a87a73d9ada83201afa63.tar.gz
frameworks_base-ee3cc8bf177c03ea571a87a73d9ada83201afa63.tar.bz2
Prevent crash in Gatt service due to null pointer in
BluetoothGattCharacteristic from framework Bug 16899517 Change-Id: Ib30ddefee07c2953f9a7faeb4eaa823feeebdc8f
Diffstat (limited to 'core/java/android/bluetooth')
-rw-r--r--core/java/android/bluetooth/BluetoothGattServer.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/java/android/bluetooth/BluetoothGattServer.java b/core/java/android/bluetooth/BluetoothGattServer.java
index 5a39dd6..c8df60e 100644
--- a/core/java/android/bluetooth/BluetoothGattServer.java
+++ b/core/java/android/bluetooth/BluetoothGattServer.java
@@ -519,6 +519,7 @@ public final class BluetoothGattServer implements BluetoothProfile {
* @param characteristic The local characteristic that has been updated
* @param confirm true to request confirmation from the client (indication),
* false to send a notification
+ * @throws IllegalArgumentException
* @return true, if the notification has been triggered successfully
*/
public boolean notifyCharacteristicChanged(BluetoothDevice device,
@@ -529,6 +530,11 @@ public final class BluetoothGattServer implements BluetoothProfile {
BluetoothGattService service = characteristic.getService();
if (service == null) return false;
+ if (characteristic.getValue() == null) {
+ throw new IllegalArgumentException("Chracteristic value is empty. Use "
+ + "BluetoothGattCharacteristic#setvalue to update");
+ }
+
try {
mService.sendNotification(mServerIf, device.getAddress(),
service.getType(), service.getInstanceId(),