Skip to content

Commit e8506e8

Browse files
committed
handle edge case no members
1 parent 3ada04e commit e8506e8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

resources/lib/UnityGroup.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,11 @@ public function disable(bool $send_mail = true): void
7373
if ($send_mail) {
7474
$member_attributes = $this->LDAP->getUsersAttributes($memberuids, ["mail"]);
7575
$member_mails = array_map(fn($x) => $x["mail"][0], $member_attributes);
76-
$this->MAILER->sendMail($member_mails, "group_disabled", [
77-
"group_name" => $this->gid,
78-
]);
76+
if (count($member_mails) > 0) {
77+
$this->MAILER->sendMail($member_mails, "group_disabled", [
78+
"group_name" => $this->gid,
79+
]);
80+
}
7981
}
8082
$this->setIsDisabled(true);
8183
if (count($memberuids) > 0) {

0 commit comments

Comments
 (0)