null check (#15841)

Signed-off-by: Leo Siepel <leosiepel@gmail.com>
This commit is contained in:
lsiepel 2023-11-04 10:29:43 +01:00 committed by GitHub
parent c7ce929aa2
commit 0a5a9912a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -16,6 +16,7 @@ import java.time.Duration;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -152,10 +153,9 @@ public class BluetoothDiscoveryService extends AbstractDiscoveryService implemen
public void deviceDiscovered(BluetoothDevice device) { public void deviceDiscovered(BluetoothDevice device) {
logger.debug("Discovered bluetooth device '{}': {}", device.getName(), device); logger.debug("Discovered bluetooth device '{}': {}", device.getName(), device);
DiscoveryCache cache = discoveryCaches.computeIfAbsent(device.getAddress(), addr -> new DiscoveryCache()); DiscoveryCache cache = Objects
if (cache != null) { .requireNonNull(discoveryCaches.computeIfAbsent(device.getAddress(), addr -> new DiscoveryCache()));
cache.handleDiscovery(device); cache.handleDiscovery(device);
}
} }
private static ThingUID createThingUIDWithBridge(DiscoveryResult result, BluetoothAdapter adapter) { private static ThingUID createThingUIDWithBridge(DiscoveryResult result, BluetoothAdapter adapter) {