Skip to content

Commit

Permalink
Fix discovery NPE (#1430)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Jackson <chris@cd-jackson.com>
  • Loading branch information
cdjackson authored Jul 8, 2024
1 parent 9df7ffb commit 60e8255
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 60e8255

Please sign in to comment.