summaryrefslogtreecommitdiffstats
path: root/java/direct_bt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-06-29 06:16:01 +0200
committerSven Gothel <[email protected]>2020-06-29 06:16:01 +0200
commitcb2875cf12344f47eb2640d393483eea464ebea4 (patch)
tree7f458b41e7477da2a21609b12aeb5e9ff4134b53 /java/direct_bt
parent28bdf814a512b0b44c181f55cac902a55f696e3d (diff)
DBTGattCharacteristic.disableValueNotifications(): Tolerate exception at 'take down' and ensure valueNotificationCB ref is nulled
Diffstat (limited to 'java/direct_bt')
-rw-r--r--java/direct_bt/tinyb/DBTGattCharacteristic.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/java/direct_bt/tinyb/DBTGattCharacteristic.java b/java/direct_bt/tinyb/DBTGattCharacteristic.java
index bd7f0dea..272735e0 100644
--- a/java/direct_bt/tinyb/DBTGattCharacteristic.java
+++ b/java/direct_bt/tinyb/DBTGattCharacteristic.java
@@ -243,9 +243,16 @@ public class DBTGattCharacteristic extends DBTObject implements BluetoothGattCha
@Override
public final synchronized void disableValueNotifications() {
- final boolean res = enableValueNotificationsImpl(false);
- if( DEBUG ) {
- System.err.println("GATTCharacteristicListener.disableValueNotifications: GATT Native: "+res);
+ try {
+ final boolean res = enableValueNotificationsImpl(false);
+ if( DEBUG ) {
+ System.err.println("GATTCharacteristicListener.disableValueNotifications: GATT Native: "+res);
+ }
+ } catch (final Throwable t) {
+ if( DEBUG ) {
+ System.err.println("Caught "+t.getMessage());
+ t.printStackTrace();
+ }
}
valueNotificationCB = null;
}