Skip to content

Commit 0310f00

Browse files
committed
fix(android): crash in onConnectionStateChange
1 parent 01297d1 commit 0310f00

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/bluetooth.android.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,10 @@ function initBluetoothGattCallback() {
725725
}
726726
});
727727
const owner = this.owner && this.owner.get();
728-
if (owner && newState === android.bluetooth.BluetoothProfile.STATE_CONNECTED && status === GATT_SUCCESS) {
728+
if (!owner) {
729+
return;
730+
}
731+
if (newState === android.bluetooth.BluetoothProfile.STATE_CONNECTED && status === GATT_SUCCESS) {
729732
const device = gatt.getDevice();
730733
let address: string = null;
731734
if (device == null) {

0 commit comments

Comments
 (0)