diff --git a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/app/discovery/ZigBeeNetworkDiscoverer.java b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/app/discovery/ZigBeeNetworkDiscoverer.java index 60c9325e9c..b92ca94328 100644 --- a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/app/discovery/ZigBeeNetworkDiscoverer.java +++ b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/app/discovery/ZigBeeNetworkDiscoverer.java @@ -402,8 +402,8 @@ private boolean getAssociatedNodes(final int networkAddress) throws InterruptedE final IeeeAddressResponse ieeeAddressResponse = response.getResponse(); logger.debug("NWK Discovery for {} IeeeAddressRequest returned {}", String.format("%04X", networkAddress), ieeeAddressResponse); - if (ieeeAddressResponse != null && ieeeAddressResponse.getStatus() == ZdoStatus.SUCCESS - && startIndex == ieeeAddressResponse.getStartIndex()) { + if (ieeeAddressResponse != null && ieeeAddressResponse.getStatus() == ZdoStatus.SUCCESS && + ieeeAddressResponse.getStartIndex() != null && startIndex == ieeeAddressResponse.getStartIndex()) { associatedDevices.addAll(ieeeAddressResponse.getNwkAddrAssocDevList()); startIndex += ieeeAddressResponse.getNwkAddrAssocDevList().size(); diff --git a/com.zsmartsystems.zigbee/src/test/java/com/zsmartsystems/zigbee/zdo/command/IeeeAddressResponseTest.java b/com.zsmartsystems.zigbee/src/test/java/com/zsmartsystems/zigbee/zdo/command/IeeeAddressResponseTest.java index 5db9335891..6df96816f7 100644 --- a/com.zsmartsystems.zigbee/src/test/java/com/zsmartsystems/zigbee/zdo/command/IeeeAddressResponseTest.java +++ b/com.zsmartsystems.zigbee/src/test/java/com/zsmartsystems/zigbee/zdo/command/IeeeAddressResponseTest.java @@ -8,6 +8,7 @@ package com.zsmartsystems.zigbee.zdo.command; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import org.junit.Test; @@ -41,6 +42,7 @@ public void testReceiveShort() { assertEquals(new IeeeAddress("0022A300001732BF"), addressResponse.getIeeeAddrRemoteDev()); assertEquals(0x8001, (int) addressResponse.getClusterId()); assertEquals(ZdoStatus.SUCCESS, addressResponse.getStatus()); + assertNull(addressResponse.getStartIndex()); } @Test