From a6401fa4acc00b97a15ba78acd36c34a0e2a840e Mon Sep 17 00:00:00 2001 From: J-N-K Date: Sun, 14 Jan 2024 19:14:00 +0100 Subject: [PATCH] Fix NPE in UpnpIOServiceImpl (#4038) Fix #4037 Signed-off-by: Jan N. Klug --- .../transport/upnp/internal/UpnpIOServiceImpl.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bundles/org.openhab.core.io.transport.upnp/src/main/java/org/openhab/core/io/transport/upnp/internal/UpnpIOServiceImpl.java b/bundles/org.openhab.core.io.transport.upnp/src/main/java/org/openhab/core/io/transport/upnp/internal/UpnpIOServiceImpl.java index 7d389bce1b9..54ec9e155fd 100644 --- a/bundles/org.openhab.core.io.transport.upnp/src/main/java/org/openhab/core/io/transport/upnp/internal/UpnpIOServiceImpl.java +++ b/bundles/org.openhab.core.io.transport.upnp/src/main/java/org/openhab/core/io/transport/upnp/internal/UpnpIOServiceImpl.java @@ -156,11 +156,13 @@ protected void eventReceived(GENASubscription sub) { for (UpnpIOParticipant participant : participants) { if (Objects.equals(getDevice(participant), deviceRoot)) { for (Entry 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;