From 01b0e23dfdc0a97de32c52eea1e48fee76ffe317 Mon Sep 17 00:00:00 2001 From: Bob A Date: Sat, 1 Aug 2020 07:06:02 -0400 Subject: [PATCH] [lutron] Fix potential NPE if bridge not initialized (#8233) Signed-off-by: Bob Adair --- .../internal/discovery/LutronDeviceDiscoveryService.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/discovery/LutronDeviceDiscoveryService.java b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/discovery/LutronDeviceDiscoveryService.java index 73be2c8c9c1a9..ce3295be910f8 100644 --- a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/discovery/LutronDeviceDiscoveryService.java +++ b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/discovery/LutronDeviceDiscoveryService.java @@ -130,6 +130,11 @@ private synchronized void asyncDiscoveryTask() { private void readDeviceDatabase() { Project project = null; + + if (bridgeHandler == null || bridgeHandler.getIPBridgeConfig() == null) { + logger.debug("Unable to get bridge config. Exiting."); + return; + } String discFileName = bridgeHandler.getIPBridgeConfig().discoveryFile; String address = "http://" + bridgeHandler.getIPBridgeConfig().ipAddress + "/DbXmlInfo.xml";