From 6deb3f56da3a6f679b0b6a7021999bcf062467e6 Mon Sep 17 00:00:00 2001 From: Bo Biene Date: Sun, 2 Jan 2022 16:51:51 +0100 Subject: [PATCH] [wolfsmartset] Fix NullPointerException when updating values (#11931) * fix bug #11930 NullPointerException Signed-off-by: Bo Biene --- .../wolfsmartset/internal/dto/GetParameterValuesDTO.java | 4 ++-- .../internal/handler/WolfSmartsetUnitThingHandler.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bundles/org.openhab.binding.wolfsmartset/src/main/java/org/openhab/binding/wolfsmartset/internal/dto/GetParameterValuesDTO.java b/bundles/org.openhab.binding.wolfsmartset/src/main/java/org/openhab/binding/wolfsmartset/internal/dto/GetParameterValuesDTO.java index bab0e0a746e..60305d5816c 100644 --- a/bundles/org.openhab.binding.wolfsmartset/src/main/java/org/openhab/binding/wolfsmartset/internal/dto/GetParameterValuesDTO.java +++ b/bundles/org.openhab.binding.wolfsmartset/src/main/java/org/openhab/binding/wolfsmartset/internal/dto/GetParameterValuesDTO.java @@ -53,8 +53,8 @@ public class GetParameterValuesDTO { this.values = values; } - public Boolean getIsNewJobCreated() { - return isNewJobCreated; + public boolean getIsNewJobCreated() { + return isNewJobCreated != null ? isNewJobCreated : false; } public void setIsNewJobCreated(Boolean isNewJobCreated) { diff --git a/bundles/org.openhab.binding.wolfsmartset/src/main/java/org/openhab/binding/wolfsmartset/internal/handler/WolfSmartsetUnitThingHandler.java b/bundles/org.openhab.binding.wolfsmartset/src/main/java/org/openhab/binding/wolfsmartset/internal/handler/WolfSmartsetUnitThingHandler.java index 47332440f6a..8a6d69f96c1 100644 --- a/bundles/org.openhab.binding.wolfsmartset/src/main/java/org/openhab/binding/wolfsmartset/internal/handler/WolfSmartsetUnitThingHandler.java +++ b/bundles/org.openhab.binding.wolfsmartset/src/main/java/org/openhab/binding/wolfsmartset/internal/handler/WolfSmartsetUnitThingHandler.java @@ -184,7 +184,7 @@ public class WolfSmartsetUnitThingHandler extends BaseThingHandler { */ public void updateValues(@Nullable GetParameterValuesDTO values) { var thingId = thing.getUID(); - if (values != null && values.getValues() != null && values.getValues().size() > 0) { + if (values != null && values.getValues() != null && !values.getValues().isEmpty()) { if (!values.getIsNewJobCreated()) { lastRefreshTime = Instant.now(); }