Skip to content

Commit

Permalink
GH-1649: Fix NPE, log warn message when no registration on notification.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernard31 committed Sep 12, 2024
1 parent 7a52fbf commit 18b8147
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,20 @@ public void onNotification(Request coapRequest, Response coapResponse) {
if (observation == null) {
LOG.warn("Unexpected error: Unable to find observation with token {} for registration {}",
coapResponse.getToken(), regid);
// We just log it because, this is probably caused by bad device behavior :
// https://github.com/eclipse-leshan/leshan/issues/1634
return;
}
// Get profile
LwM2mPeer client = identityHandler.getIdentity(coapResponse);
ClientProfile profile = toolbox.getProfileProvider().getProfile(client.getIdentity());
if (profile == null) {
LOG.warn("Unexpected error: Unable to find registration with id {} for observation {}",
regid, coapResponse.getToken());
// We just log it because, this is probably caused by bad device behavior :
// https://github.com/eclipse-leshan/leshan/issues/1634
return;
}

// create Observe Response
try {
Expand Down

0 comments on commit 18b8147

Please sign in to comment.