From 7658c1cef1396d19663ff0f23db0a5df820d3987 Mon Sep 17 00:00:00 2001 From: Jan Gustafsson Date: Sat, 15 Jun 2024 08:27:10 +0200 Subject: [PATCH] [verisure] Fix NPE (#16867) (#16868) Signed-off-by: Jan Gustafsson Signed-off-by: Ciprian Pascu --- .../verisure/internal/dto/VerisureAlarmsDTO.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureAlarmsDTO.java b/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureAlarmsDTO.java index 16abd3756d5..88b897ff387 100644 --- a/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureAlarmsDTO.java +++ b/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureAlarmsDTO.java @@ -67,7 +67,7 @@ public class VerisureAlarmsDTO extends VerisureBaseThingDTO { private @Nullable String changedVia; private boolean allowedForFirstLine; private boolean allowed; - private List errorCodes = new ArrayList<>(); + private @Nullable List errorCodes = new ArrayList<>(); private @Nullable String typename; public @Nullable String getType() { @@ -102,7 +102,7 @@ public class VerisureAlarmsDTO extends VerisureBaseThingDTO { return allowed; } - public List getErrorCodes() { + public @Nullable List getErrorCodes() { return errorCodes; } @@ -120,7 +120,7 @@ public class VerisureAlarmsDTO extends VerisureBaseThingDTO { result = prime * result + ((localChangedVia == null) ? 0 : localChangedVia.hashCode()); String localDate = date; result = prime * result + ((localDate == null) ? 0 : localDate.hashCode()); - result = prime * result + errorCodes.hashCode(); + result = prime * result + ((errorCodes == null) ? 0 : errorCodes.hashCode()); String localName = name; result = prime * result + ((localName == null) ? 0 : localName.hashCode()); String localStatusType = statusType; @@ -166,7 +166,11 @@ public class VerisureAlarmsDTO extends VerisureBaseThingDTO { } else if (!localdate.equals(other.date)) { return false; } - if (!errorCodes.equals(other.errorCodes)) { + if (this.errorCodes == null) { + if (other.errorCodes != null) { + return false; + } + } else if (this.errorCodes != null && !this.errorCodes.equals(other.errorCodes)) { return false; } String localName = name;