Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ffabc511 authored by Prerepa Viswanadham's avatar Prerepa Viswanadham
Browse files

Prevent crash in Gatt service due to null pointer in

BluetoothGattCharacteristic from framework

Bug 16899517

Change-Id: Ib30ddefee07c2953f9a7faeb4eaa823feeebdc8f
parent e13f66a3
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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(),