Fix NPE in UpnpIOServiceImpl (#4038)

Fix #4037

Signed-off-by: Jan N. Klug <github@klug.nrw>
This commit is contained in:
J-N-K 2024-01-14 19:14:00 +01:00 committed by GitHub
parent 6495f4e256
commit a6401fa4ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -156,11 +156,13 @@ public class UpnpIOServiceImpl implements UpnpIOService, RegistryListener {
for (UpnpIOParticipant participant : participants) {
if (Objects.equals(getDevice(participant), deviceRoot)) {
for (Entry<String, StateVariableValue> entry : values.entrySet()) {
try {
participant.onValueReceived(entry.getKey(), entry.getValue().getValue().toString(),
serviceId);
} catch (Exception e) {
logger.error("Participant threw an exception onValueReceived", e);
Object value = entry.getValue().getValue();
if (value != null) {
try {
participant.onValueReceived(entry.getKey(), value.toString(), serviceId);
} catch (Exception e) {
logger.error("Participant threw an exception onValueReceived", e);
}
}
}
break;