Prevent compiler error in Eclipse due to potential null value (#3210)

Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
Kai Kreuzer 2022-12-11 01:33:10 +01:00 committed by GitHub
parent 0d9b678f36
commit 664fb559a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1093,6 +1093,9 @@ public class RuleEngineImpl implements RuleManager, RegistryChangeListener<Modul
*/
private Map<String, Object> getContext(String ruleUID, @Nullable Set<Connection> connections) {
Map<String, Object> 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) {