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
This commit is contained in:
gaudryc
2019-01-06 21:43:39 +01:00
parent 9cbc290768
commit 1311d4a68d

View File

@@ -143,9 +143,12 @@ public class BroadlinkHome implements Home {
if(broadlinkMap == null) if(broadlinkMap == null)
broadlinkMap = new HashMap<String, BLDevice>(); broadlinkMap = new HashMap<String, BLDevice>();
String newId = theDevice.getHost() + "-" + String.format("%04x", theDevice.getDeviceType()); if (theDevice != null) {
if(broadlinkMap.get(newId) == null) String newId = theDevice.getHost() + "-" + String.format("%04x", theDevice.getDeviceType());
broadlinkMap.put(newId, theDevice); if (broadlinkMap.get(newId) == null) {
broadlinkMap.put(newId, theDevice);
}
}
} }
} }
if (theDevice == null) { if (theDevice == null) {