Skip to content

Commit

Permalink
[bluetooth.bluez] Fix NullPointerException (openhab#18185)
Browse files Browse the repository at this point in the history
Fixes openhab#18180

Signed-off-by: Jacob Laursen <[email protected]>
  • Loading branch information
jlaur authored Jan 26, 2025
1 parent f479a38 commit a23086f
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ private void ensureConnected() {
return null;
}
for (BluetoothGattService service : dev.getGattServices()) {
for (BluetoothGattCharacteristic c : service.getGattCharacteristics()) {
if (uuid.equalsIgnoreCase(c.getUuid())) {
return c;
for (BluetoothGattCharacteristic characteristic : service.getGattCharacteristics()) {
if (characteristic != null && uuid.equalsIgnoreCase(characteristic.getUuid())) {
return characteristic;
}
}
}
Expand All @@ -235,7 +235,7 @@ private void ensureConnected() {
for (BluetoothGattService service : dev.getGattServices()) {
if (dBusPath.startsWith(service.getDbusPath())) {
for (BluetoothGattCharacteristic characteristic : service.getGattCharacteristics()) {
if (dBusPath.startsWith(characteristic.getDbusPath())) {
if (characteristic != null && dBusPath.startsWith(characteristic.getDbusPath())) {
return characteristic;
}
}
Expand Down

0 comments on commit a23086f

Please sign in to comment.