[tellstick] Fix for NPE (#10377) (#10378)

Signed-off-by: Jan Gustafsson <jannegpriv@gmail.com>
This commit is contained in:
Jan Gustafsson 2021-03-23 08:39:17 +01:00 committed by GitHub
parent c709f52d66
commit 5477fa5fb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -128,8 +128,8 @@ public class TelldusLiveBridgeHandler extends BaseBridgeHandler implements Telld
private synchronized void updateDevices(TellstickNetDevices previouslist) throws TellstickException {
TellstickNetDevices newList = controller.callRestMethod(TelldusLiveDeviceController.HTTP_TELLDUS_DEVICES,
TellstickNetDevices.class);
logger.debug("Device list {}", newList.getDevices());
if (newList.getDevices() != null) {
logger.debug("Device list {}", newList.getDevices());
if (previouslist == null) {
logger.debug("updateDevices, Creating devices.");
for (TellstickNetDevice device : newList.getDevices()) {
@ -172,6 +172,8 @@ public class TelldusLiveBridgeHandler extends BaseBridgeHandler implements Telld
device.setUpdated(false);
}
}
} else {
logger.debug("updateDevices, rest API returned null");
}
}

View File

@ -111,8 +111,8 @@ public class TelldusLocalBridgeHandler extends BaseBridgeHandler implements Tell
throws TellstickException, InterruptedException {
TellstickLocalDevicesDTO newList = controller
.callRestMethod(TelldusLocalDeviceController.HTTP_LOCAL_API_DEVICES, TellstickLocalDevicesDTO.class);
logger.debug("Device list {}", newList.getDevices());
if (newList.getDevices() != null) {
logger.debug("Device list {}", newList.getDevices());
if (previouslist == null) {
for (TellstickLocalDeviceDTO device : newList.getDevices()) {
device.setUpdated(true);
@ -158,6 +158,8 @@ public class TelldusLocalBridgeHandler extends BaseBridgeHandler implements Tell
device.setUpdated(false);
}
}
} else {
logger.debug("updateDevices, rest API returned null");
}
}