From 664fb559a4e85776463c0f36d15f1ea1ea08be93 Mon Sep 17 00:00:00 2001 From: Kai Kreuzer Date: Sun, 11 Dec 2022 01:33:10 +0100 Subject: [PATCH] Prevent compiler error in Eclipse due to potential null value (#3210) Signed-off-by: Kai Kreuzer --- .../org/openhab/core/automation/internal/RuleEngineImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleEngineImpl.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleEngineImpl.java index f0b58e278..4c7bf7372 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleEngineImpl.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleEngineImpl.java @@ -1093,6 +1093,9 @@ public class RuleEngineImpl implements RuleManager, RegistryChangeListener getContext(String ruleUID, @Nullable Set connections) { Map context = contextMap.computeIfAbsent(ruleUID, k -> new HashMap<>()); + if (context == null) { + throw new IllegalStateException("context cannot be null at that point - please report a bug."); + } if (connections != null) { StringBuffer sb = new StringBuffer(); for (Connection c : connections) {