From 70dbfc28b7e61f78d0e76728c3e1b98d9fbd317d Mon Sep 17 00:00:00 2001 From: Jan Jakes Date: Fri, 31 Mar 2023 11:26:04 +0200 Subject: [PATCH] Early return when no active automation matches given trigger [MAILPOET-4946] --- mailpoet/lib/Automation/Engine/Control/TriggerHandler.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mailpoet/lib/Automation/Engine/Control/TriggerHandler.php b/mailpoet/lib/Automation/Engine/Control/TriggerHandler.php index 453360be60..b4bac7958c 100644 --- a/mailpoet/lib/Automation/Engine/Control/TriggerHandler.php +++ b/mailpoet/lib/Automation/Engine/Control/TriggerHandler.php @@ -59,8 +59,12 @@ class TriggerHandler { /** @param Subject[] $subjects */ public function processTrigger(Trigger $trigger, array $subjects): void { - $subjects = $this->subjectTransformerHandler->getAllSubjects($subjects); $automations = $this->automationStorage->getActiveAutomationsByTrigger($trigger); + if (!$automations) { + return; + } + + $subjects = $this->subjectTransformerHandler->getAllSubjects($subjects); foreach ($automations as $automation) { $step = $automation->getTrigger($trigger->getKey()); if (!$step) {