]> git.basschouten.com Git - openhab-addons.git/commitdiff
Fix NullPointerException (#14010)
authorJacob Laursen <jacob-github@vindvejr.dk>
Sun, 18 Dec 2022 22:22:40 +0000 (23:22 +0100)
committerGitHub <noreply@github.com>
Sun, 18 Dec 2022 22:22:40 +0000 (23:22 +0100)
Fixes #13961

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/provider/ShellyChannelDefinitions.java

index 0d27bae8eb24eabbd8d61b87bfe731fcee904016..f5d1177b6566692f72c446d72f9e1b8ad4fd7db4 100644 (file)
@@ -344,10 +344,10 @@ public class ShellyChannelDefinitions {
         }
 
         // Shelly 1/1PM and Plus 1/1PM Addon
-        addChannel(thing, add,
-                profile.settings.extSwitch != null && profile.settings.extSwitch.input0 != null
-                        && idx == getInteger(profile.settings.extSwitch.input0.relayNum),
-                CHGR_SENSOR, CHANNEL_ESENSOR_INPUT + (profile.settings.extSwitch.input0.relayNum + 1));
+        if (profile.settings.extSwitch != null && profile.settings.extSwitch.input0 != null
+                && idx == getInteger(profile.settings.extSwitch.input0.relayNum)) {
+            addChannel(thing, add, true, CHGR_SENSOR, CHANNEL_ESENSOR_INPUT + (idx + 1));
+        }
         if (profile.status.extTemperature != null) {
             addChannel(thing, add, profile.status.extTemperature.sensor1 != null, CHGR_SENSOR, CHANNEL_ESENSOR_TEMP1);
             addChannel(thing, add, profile.status.extTemperature.sensor2 != null, CHGR_SENSOR, CHANNEL_ESENSOR_TEMP2);