From dcb0243cd7d926ea7f03dc3557d6827bb352b760 Mon Sep 17 00:00:00 2001 From: Martijn van Welie Date: Sat, 29 Jan 2022 09:05:47 +0100 Subject: [PATCH] Get rid of some !! --- .../src/main/java/com/welie/blessed/BluetoothPeripheral.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blessed/src/main/java/com/welie/blessed/BluetoothPeripheral.kt b/blessed/src/main/java/com/welie/blessed/BluetoothPeripheral.kt index 3c11710..a4d9570 100644 --- a/blessed/src/main/java/com/welie/blessed/BluetoothPeripheral.kt +++ b/blessed/src/main/java/com/welie/blessed/BluetoothPeripheral.kt @@ -576,7 +576,7 @@ class BluetoothPeripheral internal constructor( state = BluetoothProfile.STATE_DISCONNECTING scope.launch { if (state == BluetoothProfile.STATE_DISCONNECTING && bluetoothGatt != null) { - bluetoothGatt!!.disconnect() + bluetoothGatt?.disconnect() } } } else { @@ -810,7 +810,7 @@ class BluetoothPeripheral internal constructor( return enqueue { if (isConnected) { currentResultCallback = resultCallback - if (bluetoothGatt!!.readCharacteristic(characteristic)) { + if (bluetoothGatt?.readCharacteristic(characteristic) == true) { Logger.d(TAG, "reading characteristic <%s>", characteristic.uuid) nrTries++ } else { @@ -911,7 +911,7 @@ class BluetoothPeripheral internal constructor( Logger.w(TAG, "value byte array is longer than allowed by MTU, write will fail if peripheral does not support long writes") } characteristic.value = bytesToWrite - if (bluetoothGatt?.writeCharacteristic(characteristic) ?: false) { + if (bluetoothGatt?.writeCharacteristic(characteristic) == true) { Logger.d(TAG, "writing <%s> to characteristic <%s>", BluetoothBytesParser.bytes2String(bytesToWrite), characteristic.uuid) nrTries++ } else {