Skip to content

Commit

Permalink
Merge pull request #1138 from AnomalousLLC/master
Browse files Browse the repository at this point in the history
Fix recursive loops causing StackOverflowError on Android 13+
  • Loading branch information
marcosinigaglia authored Dec 12, 2023
2 parents 6acdf54 + 02792c2 commit 2d92d2c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions android/src/main/java/it/innove/Peripheral.java
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,10 @@ public void updateData(byte[] data) {

@Override
public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
super.onCharacteristicChanged(gatt, characteristic);
onCharacteristicChanged(gatt, characteristic, characteristic.getValue());
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
super.onCharacteristicChanged(gatt, characteristic);
onCharacteristicChanged(gatt, characteristic, characteristic.getValue());
}
}

@Override
Expand Down Expand Up @@ -468,8 +470,10 @@ public void onCharacteristicChanged(@NonNull final BluetoothGatt gatt, @NonNull

@Override
public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
super.onCharacteristicRead(gatt, characteristic, status);
onCharacteristicRead(gatt, characteristic, characteristic.getValue(), status);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
super.onCharacteristicRead(gatt, characteristic, status);
onCharacteristicRead(gatt, characteristic, characteristic.getValue(), status);
}
}
@Override
public void onCharacteristicRead(@NonNull final BluetoothGatt gatt,
Expand Down

0 comments on commit 2d92d2c

Please sign in to comment.