From 3f5d795e155246819d05d2822bb85f9f1651e9fd Mon Sep 17 00:00:00 2001 From: Nico Schmitz Date: Tue, 16 Oct 2018 01:33:08 +0200 Subject: [PATCH] Fix bug in TriggerConnector.shouldRun() --- .../automation/triggers/TriggerConnector.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerConnector.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerConnector.java index 6a9c2cee7e..46b20b7cf6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerConnector.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerConnector.java @@ -102,11 +102,17 @@ public class TriggerConnector extends Trigger { @Override public synchronized boolean shouldRun() { - boolean result = false; + boolean result = true; - for (Trigger t : list) { - result = connectorType.apply(result, t.shouldRun()); + // check first trigger + if (list.size() > 0) + result = list.get(0).shouldRun(); + + // check all others + for (int i = 1; i < list.size(); ++i) { + result = connectorType.apply(result, list.get(i).shouldRun()); } + return result; }