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

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

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
parent 5682be9e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;