From 1311d4a68df75cc10502dcc14bf26638d40126f4 Mon Sep 17 00:00:00 2001 From: gaudryc Date: Sun, 6 Jan 2019 21:43:39 +0100 Subject: [PATCH] Bug: Possible null pointer dereference in method com.bwssystems.HABridge.plugins.broadlink.BroadlinkHome.deviceHandler(CallItem, MultiCommandUtil, String, int, Integer, Integer, ColorData, DeviceDescriptor, String) on exception path --- .../HABridge/plugins/broadlink/BroadlinkHome.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/bwssystems/HABridge/plugins/broadlink/BroadlinkHome.java b/src/main/java/com/bwssystems/HABridge/plugins/broadlink/BroadlinkHome.java index 8ef6fc3..0499e91 100644 --- a/src/main/java/com/bwssystems/HABridge/plugins/broadlink/BroadlinkHome.java +++ b/src/main/java/com/bwssystems/HABridge/plugins/broadlink/BroadlinkHome.java @@ -143,9 +143,12 @@ public class BroadlinkHome implements Home { if(broadlinkMap == null) broadlinkMap = new HashMap(); - String newId = theDevice.getHost() + "-" + String.format("%04x", theDevice.getDeviceType()); - if(broadlinkMap.get(newId) == null) - broadlinkMap.put(newId, theDevice); + if (theDevice != null) { + String newId = theDevice.getHost() + "-" + String.format("%04x", theDevice.getDeviceType()); + if (broadlinkMap.get(newId) == null) { + broadlinkMap.put(newId, theDevice); + } + } } } if (theDevice == null) {