]> git.basschouten.com Git - openhab-addons.git/commitdiff
Fix null pointer exception for invalid protocolInfo. (#12632)
authorMark Herwege <mherwege@users.noreply.github.com>
Fri, 22 Apr 2022 06:53:58 +0000 (08:53 +0200)
committerGitHub <noreply@github.com>
Fri, 22 Apr 2022 06:53:58 +0000 (08:53 +0200)
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
bundles/org.openhab.binding.upnpcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/queue/UpnpEntryRes.java

index ee8149d0ee24368391e6bed4415cf1dabce9b0b3..bbc91028fbd638fc6ead29aeaac97d5b50e41edd 100644 (file)
@@ -28,9 +28,12 @@ public class UpnpEntryRes {
     private String importUri;
     private String res = "";
 
-    public UpnpEntryRes(String protocolInfo, @Nullable Long size, @Nullable String duration,
+    public UpnpEntryRes(@Nullable String protocolInfo, @Nullable Long size, @Nullable String duration,
             @Nullable String importUri) {
-        this.protocolInfo = protocolInfo.trim();
+        // According to the UPnP standard, res should always contain protocolInfo. Some devices do not respect this
+        // standard in their AVTransport implementation. To avoid null pointer exceptions, take care of this special
+        // case.
+        this.protocolInfo = (protocolInfo == null) ? "*" : protocolInfo.trim();
         this.size = size;
         this.duration = (duration == null) ? "" : duration.trim();
         this.importUri = (importUri == null) ? "" : importUri.trim();