From: Nicolas Iooss Date: Wed, 6 Nov 2013 22:49:17 +0000 (+0100) Subject: Fix null pointer dereference when sending a mail to validate the subscription to... X-Git-Tag: xorg/1.1.10~12^2~1 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=4f22e8566b1dd53866bc5d0eb8033e8c425e6209;p=platal.git Fix null pointer dereference when sending a mail to validate the subscription to a group Fix this error: PHP Fatal error: Call to a member function bestEmail() on a non-object Signed-off-by: Nicolas Iooss --- diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index 051b0da..744e4e0 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -831,9 +831,13 @@ class XnetGrpModule extends PLModule S::i('uid'), $globals->asso('id')); $admins = $globals->asso()->iterToNotify(); $admin = $admins->next(); - $to = $admin->bestEmail(); - while ($admin = $admins->next()) { - $to .= ', ' . $admin->bestEmail(); + if (!is_null($admin)) { + $to = $admin->bestEmail(); + while ($admin = $admins->next()) { + $to .= ', ' . $admin->bestEmail(); + } + } else { + $to = ''; } $append = "\n"