[smartmeter] Fix NPE while trying to get ChannelType (#10007)

Fixes #10006

Signed-off-by: Stefan Triller <github@stefantriller.de>
This commit is contained in:
Stefan Triller 2021-01-31 21:59:22 +01:00 committed by GitHub
parent 4c7f9efffa
commit f2ea947424
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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