]> git.basschouten.com Git - openhab-addons.git/commitdiff
[smartmeter] Fix NPE while trying to get ChannelType (#10007)
authorStefan Triller <t2000@users.noreply.github.com>
Sun, 31 Jan 2021 20:59:22 +0000 (21:59 +0100)
committerGitHub <noreply@github.com>
Sun, 31 Jan 2021 20:59:22 +0000 (21:59 +0100)
Fixes #10006

Signed-off-by: Stefan Triller <github@stefantriller.de>
bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/SmartMeterChannelTypeProvider.java

index a5f1f3d2401bcf672ba42f77b471c31e73ccc899..7962f069c1332436046aeb34aa6954e6fa817b26 100644 (file)
@@ -107,6 +107,7 @@ public class SmartMeterChannelTypeProvider implements ChannelTypeProvider, Meter
      * @return The {@link ChannelTypeUID} or null.
      */
     public ChannelTypeUID getChannelTypeIdForObis(String obis) {
-        return obisChannelMap.get(obis).getUID();
+        ChannelType channeltype = obisChannelMap.get(obis);
+        return channeltype != null ? channeltype.getUID() : null;
     }
 }