From 4f22e8566b1dd53866bc5d0eb8033e8c425e6209 Mon Sep 17 00:00:00 2001 From: Nicolas Iooss Date: Wed, 6 Nov 2013 23:49:17 +0100 Subject: [PATCH] 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 --- modules/xnetgrp.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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" -- 2.1.4