From 99410f58dc41bee64349331ca094c833818dffc5 Mon Sep 17 00:00:00 2001 From: Eliot Lear Date: Wed, 4 Sep 2024 14:29:35 +0200 Subject: [PATCH] Add a null check around $connect_to_user --- Action/ConvertEmailToComment.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Action/ConvertEmailToComment.php b/Action/ConvertEmailToComment.php index 705d457..c943028 100755 --- a/Action/ConvertEmailToComment.php +++ b/Action/ConvertEmailToComment.php @@ -133,12 +133,15 @@ public function doAction(array $data) $project_users = array_merge($userMembers, $groupMembers); $user_in_project = false; - foreach ($project_users as $user) { - if ($user['id'] = $connect_to_user['id']) { - $user_in_project = true; - break; + if ( ! is_null($connect_to_user) ) { + foreach ($project_users as $user) { + if ($user['id'] = $connect_to_user['id']) { + $user_in_project = true; + break; + } } } + if ($user_in_project) { $comment = (isset($subject) ? "#$subject\n\n" : '') . (isset($message) ? $message : ''); $values = array(