Skip to content

Commit a23086f

Browse files
authored
[bluetooth.bluez] Fix NullPointerException (openhab#18185)
Fixes openhab#18180 Signed-off-by: Jacob Laursen <[email protected]>
1 parent f479a38 commit a23086f

File tree

1 file changed

+4
-4
lines changed
  • bundles/org.openhab.binding.bluetooth.bluez/src/main/java/org/openhab/binding/bluetooth/bluez/internal

1 file changed

+4
-4
lines changed

bundles/org.openhab.binding.bluetooth.bluez/src/main/java/org/openhab/binding/bluetooth/bluez/internal/BlueZBluetoothDevice.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ private void ensureConnected() {
218218
return null;
219219
}
220220
for (BluetoothGattService service : dev.getGattServices()) {
221-
for (BluetoothGattCharacteristic c : service.getGattCharacteristics()) {
222-
if (uuid.equalsIgnoreCase(c.getUuid())) {
223-
return c;
221+
for (BluetoothGattCharacteristic characteristic : service.getGattCharacteristics()) {
222+
if (characteristic != null && uuid.equalsIgnoreCase(characteristic.getUuid())) {
223+
return characteristic;
224224
}
225225
}
226226
}
@@ -235,7 +235,7 @@ private void ensureConnected() {
235235
for (BluetoothGattService service : dev.getGattServices()) {
236236
if (dBusPath.startsWith(service.getDbusPath())) {
237237
for (BluetoothGattCharacteristic characteristic : service.getGattCharacteristics()) {
238-
if (dBusPath.startsWith(characteristic.getDbusPath())) {
238+
if (characteristic != null && dBusPath.startsWith(characteristic.getDbusPath())) {
239239
return characteristic;
240240
}
241241
}

0 commit comments

Comments
 (0)