From: Cody Cutrer Date: Thu, 11 Apr 2024 19:54:49 +0000 (-0600) Subject: [mqtt] fix UnDefType comparison in PercentageValue (#16639) X-Git-Url: https://git.basschouten.com/?a=commitdiff_plain;h=c007c6ad5cb6030a210afe79c7f763506e1f0c77;p=openhab-addons.git [mqtt] fix UnDefType comparison in PercentageValue (#16639) Signed-off-by: Cody Cutrer --- diff --git a/bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/values/PercentageValue.java b/bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/values/PercentageValue.java index 8bcd75526e..00c4af0ad8 100644 --- a/bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/values/PercentageValue.java +++ b/bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/values/PercentageValue.java @@ -73,7 +73,7 @@ public class PercentageValue extends Value { @Override public PercentType parseCommand(Command command) throws IllegalArgumentException { - PercentType oldvalue = (state == UnDefType.UNDEF) ? new PercentType() : (PercentType) state; + PercentType oldvalue = (state instanceof UnDefType) ? new PercentType() : (PercentType) state; // Nothing do to -> We have received a percentage if (command instanceof PercentType percent) { return percent;